# 428485 Vector Displacement

Create an OpenGL, C++ application that will simulate projectile motion including initial velocity and gravity in 3 dimensions.

1) Need Project completed by July 24, 2010 in Visual Studio 2005

2) Part of the project listed below. Enire project in attached Word document.

***********************

Modify the projectile.h file so that the projectile travels according to the equations of motion. More specifically, modify the Update() function.

The Update() function is what contains the incorrect motion code. It contains some function calls that might be useful.

The movement is updated, using SetTimer, at dt milliseconds.

You will update velocity (since acceleration is not zero) and you will update position. An idea is to update velocity and position in the Update function by considering these two lines of pseudocode:

velocity = velocity +a*dt

position = position + (1/2)*(v_f +v_i)*dt

(Note: try not to use 1/2 in C++, but rather use 0.5)

You will use -32.2 for the second component of acceleration.

One idea with which one can start bfore updating velocity can be to introduce an initial velocity vector:

Vector3 initvel; //initial velocity vector, or old velocity vector

initvel = vel; // initial velocity is initialized to the current velocity

Some examples (found in the green box below) of what the methods set, scale, and

In the green box below are some methods or function examples, found in gmath.h,

that act on vectors of type Vector3. These are just examples of what those

functions do and are not to be used literally word-for-word in the iLab.

Similarly, the numbers that you see in this green box are not to be used in the

iLab, they are just examples. Suppose that U, V, and W are 3D vectors of type

Vector3, whose components are of type double.

Vector3 U, V, W;

[url removed, login to view](5.2, 1.1, -0.4); //This sets, or initializes, the 3D vector,

U, to U = (5.2, 1.1, -0.4)

[url removed, login to view](-3.1, 7.8, 5.5); //This sets, or initializes, the 3D vector, V,

to V = (-3.1, 7.8, 5.5)

[url removed, login to view](-2); //This multiplies U by -2, i.e. U= -2*U = (

-10.4, -2.2, 0.8)

W = Add(U,V); //This adds: W=U+V, i.e. W= U+V = ( -10.4, -2.2,

0.8) + (-3.1, 7.8, 5.5) = (-13.5, 5.6, 6.3)

Note: These are just hypothetical examples meant to help you understand what

these methods do in general and not meant to be submitted word-for-word as you

see them here. For example, in other words, do not submit this in your iLab:

[url removed, login to view](5.2, 1.1, -0.4);

nor this

[url removed, login to view](5.2, 1.1, -0.4);

You may, if necessary, declare your own Vector3 variables within the Update()

function to make it run well, in addition to the ones already declared there.

If you think you did it correctly but still do not see it travel in a parabolic

path in the sense that it is going up forever, it might be that you need to

change

to

Another idea is to manually increase your field of view slider to better see its

path.

The cannon.h file handles the rotation of the cannon. In addition, it gives the

initial position of the projectile, as a vector. This initial position is used

in the projectile.h file, in the constructor Projectile.

Also, got to the [url removed, login to view] file and modify sprintf to put your name.

スキル： その他

( 4件のレビュー )

プロジェクトID: #2174355

coderTim

as discussed.

\$60 USD 3日以内
(56レビュー)
5.1