#### Archived

This topic is now archived and is closed to further replies.

# Parabola

This topic is 5096 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Given a 3D point P and a direction vector D how can i trace a parabola from P going in the direction of D. I want the parabola to go up the Y axis first and then down it. I know that in the 2D case parabolas are easy to calculate but i''m having problems in 3D.

##### Share on other sites
well a vector has a direction and the direction of a parabola changes...so therefore the direction of the vector must change as well or you are no longer drawing a parabola in the direction of the vector..........but i digress

i know what you are doing and what kind of game you are making just from that question

or at least a best guest

you are making some type of 3d scortched earth game

and you have a yaw and pitch that the firing mechanism is facing.....now you want to fire with an amount of force in the direction you are facing...hence the vector

now you want the particle you fire to initially be travelling in the direction of the vector but of course gravity is bringing it back down at a fixed rate of acceleration.

now what you want to do is google something like "physics position equations"" or "equations of gravity"

they will give you equations to calculate positions based on initial position, initial velocity and acceleration based in terms of time elapsed

ie where you are, initial velocity of the projectile, and gravity.

"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

##### Share on other sites
Actually its the path i plan on making a grenade follow when fired from a grenade launcher in a FPS. But now i digress.

I want the parabola to have its first point at position P and be plotted moving away from P in the direction of D. I really don''t see a need for any heavy physics caluclations here I just need to know how to keep the parabola in the plane along which the direction vector is pointing.

Any ideas?

##### Share on other sites
no physics equations? that is exactly what the flight path of the grenade is following.....seriously you have to look up the equations with position and acceleration

looking for an equation of gravity will make it easier on you

or do this
float time_elapsed_since_last_frame = figure_it_out_yourself;pos_x += velocity_x * time_elapsed_since_last_frame;pos_y += velocity_y * time_elapsed_since_last_frame;velocity_y -= SOME_GRAVITY_CONSTANT *              time_elapsed_since_last_frame;// constantly check that the pos_y is < terrain_height and// if true then it has hit the ground

"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

##### Share on other sites
r = (1/2)at2 + v0t + r0

a = (0, 0, -9.81 m/s2), assuming the z-axis is vertical.
v0 is the initial velocity.
r0 is the initial position.

##### Share on other sites
Thx Terran, BTW NCSU, gravity has nothing to do with plotting a parabola and neither do physical forces such as acceleration etc

##### Share on other sites
hahahha you gotta be kidding me man

what do you think the

a = (0, 0, -9.81 m/s2), assuming the z-axis is vertical

is in the equations in the post above this

those are physics equations for a body in motion

and the a is acceleration and the -9.81 m/s^2 is the acceleration of gravity

but you are right about in the math world you can have a parametric equation or other equation for a parabola that doesnt directly have "forces" but i guarantee you that everyone uses those physics equations for stuff like thrown grenades in their game as in the real world it follows those equations and not the equation of a parabola.....although they are nearly the same

"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

[edited by - ncsu121978 on February 6, 2004 10:16:34 AM]