vHitLocation = vStartLocation + (vVelocity * fTime) + (vGravity * (fTime*fTime) * 0.5f); vVelocity = ?? 
Help with physics
Started by BobJelly, Jun 29 2001 05:48 AM
9 replies to this topic
#1 Members  Reputation: 122
Posted 29 June 2001  05:48 AM
Hi all !
I want my player to throw an object at an exact location (with a motion along a parabola). The problem is, I need to find the velocity needed... I have the start location, the hit location, the acceleration (only gravity here)... but I also need the time to be able to find the value of the velocity (maybe i''m wrong here) !
Do you have any idea on how i could proceed ?
Sponsor:
#2 Members  Reputation: 122
Posted 29 June 2001  06:29 AM
Hum i forgot something... I know the angle at wich my object is thrown...
Much better... Still I don''t know how I could find the value of fTime and fSpeed... they are both dependant one on the other
I''m sure I''m doing something wrong...

Much better... Still I don''t know how I could find the value of fTime and fSpeed... they are both dependant one on the other
I''m sure I''m doing something wrong...
#3 Anonymous Poster_Anonymous Poster_* Guests  Reputation:
Posted 29 June 2001  06:47 AM
well, I am thinkin about this, do you by any chance know the maximum height this object achieves, b/c if you do then you can calculate airtime, and therefor total time, and therefore velocity.
#4 Members  Reputation: 122
Posted 29 June 2001  08:17 AM
Here''s my solution:
The path of a projectile can be modeled by the parametric equtations:
x_coordinate(time) = original_velocity * cos(theta) * time
and
y_coordinate(time) = original_height + (original_velocity * sin(theta)* time)  acceleration_due_to_gravity * time^2
The graph of these equations produces the trajectory of the projectile.
The acceleration due to gravity is based on the measurement system, metric is 9.8 m/(s^2) while english is 16 ft/(s^2).
Assuming you only have two unknowns, and that they appear in both equations, finding those unknowns is a simple matter of substitution.
In the case of BobJelly, all you have to do is substitute the values you know and solve for time, which will be in terms of the original velocity.
Substitution of that value back into the second equation produces a one value equation with the only variable being the original velocity.
The only thing that now remains is the trivial proceeding of solving the second equation for the original velocity and there you go.
That should do just about do it, hope I explained it well enough.
Peace out.
The path of a projectile can be modeled by the parametric equtations:
x_coordinate(time) = original_velocity * cos(theta) * time
and
y_coordinate(time) = original_height + (original_velocity * sin(theta)* time)  acceleration_due_to_gravity * time^2
The graph of these equations produces the trajectory of the projectile.
The acceleration due to gravity is based on the measurement system, metric is 9.8 m/(s^2) while english is 16 ft/(s^2).
Assuming you only have two unknowns, and that they appear in both equations, finding those unknowns is a simple matter of substitution.
In the case of BobJelly, all you have to do is substitute the values you know and solve for time, which will be in terms of the original velocity.
Substitution of that value back into the second equation produces a one value equation with the only variable being the original velocity.
The only thing that now remains is the trivial proceeding of solving the second equation for the original velocity and there you go.
That should do just about do it, hope I explained it well enough.
Peace out.
#5 Moderators  Reputation: 1365
Posted 29 June 2001  09:19 AM
I'm following the exact approach as Wizardry here. I've derived the final answer so you don't have to do as much work.
Lets see, you *know* the following:
start (throw) position (x0, y0)
end (hit) position (x1, y1)
lets say x is positive to the right, y positive up.
start angle, call it theta0 (in radians), measured from horizontal
gravity (g in y direction)
You want to find the following:
tv = throwing velocity
th = time of hit
Your projectile motion path is given by these two scalar equations:
Of course, you could write it as the two vector equations, with x acceleration component being 0.
The time, t, is measured from the time of the throwso that the time of the throw is t = 0.
At the time of hitting your target, (time = th), you have
There are two unknowns, th and tv. You have to solve the last two equations simulataneously. Start by solving the first equation for tv:
Then rewrite the second equation
Simplifying (note that th drops out of second term and
sin/cos = tan),
Or,
Solving for th,
Take the positive square root since negative time isn't physically consistent here. If the discreminant of the sqrt term is negative then it means you *cannot* hit the target for the given throwing angle (i.e., you cannot hit a target at a higher position if object is thrown horizontally).
Then, from the earlier equation
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Edited by  grhodes_at_work on June 29, 2001 4:26:56 PM
Lets see, you *know* the following:
start (throw) position (x0, y0)
end (hit) position (x1, y1)
lets say x is positive to the right, y positive up.
start angle, call it theta0 (in radians), measured from horizontal
gravity (g in y direction)
You want to find the following:
tv = throwing velocity
th = time of hit
Your projectile motion path is given by these two scalar equations:
x(t) = x0 + tv*cos(theta0)*t
y(t) = y0 + tv*sin(theta0)*t  g*t*t/2
Of course, you could write it as the two vector equations, with x acceleration component being 0.
The time, t, is measured from the time of the throwso that the time of the throw is t = 0.
At the time of hitting your target, (time = th), you have
x(th) = x1 = x0 + tv*cos(theta0)*th
y(th) = y1 = y0 + tv*sin(theta0)*th  g*th*th/2
There are two unknowns, th and tv. You have to solve the last two equations simulataneously. Start by solving the first equation for tv:
tv = (x1x0)/(th*cos(theta0))
Then rewrite the second equation
y1 = y0 + (x1x0)*sin(theta0)*th/(th*cos(theta0))  g*th*th/2
Simplifying (note that th drops out of second term and
sin/cos = tan),
y1 = y0 + (x1x0)*tan(theta0)  g*th*th/2
Or,
g*th*th/2 = y0y1 + (x1x0)*tan(theta0)
Solving for th,
th = sqrt((2/g) * (y0y1 + (x1x0)*tan(theta0)))
Take the positive square root since negative time isn't physically consistent here. If the discreminant of the sqrt term is negative then it means you *cannot* hit the target for the given throwing angle (i.e., you cannot hit a target at a higher position if object is thrown horizontally).
Then, from the earlier equation
tv = (x1x0)/(th*cos(theta0))
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Edited by  grhodes_at_work on June 29, 2001 4:26:56 PM
#6 Moderators  Reputation: 1365
Posted 29 June 2001  09:32 AM
Found a couple of inconsistencies in Wizardry''s post:
You need to divide your last term by 2 so that:
Actually, in English units its roughly 32 ft/(s^2), .
Yes, peace.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
quote:
Original post by Wizardry
y_coordinate(time) = original_height + (original_velocity * sin(theta)* time)  acceleration_due_to_gravity * time^2
You need to divide your last term by 2 so that:
y_coordinate(time) = original_height + (original_velocity * sin(theta)* time)  (acceleration_due_to_gravity * time^2)/2
quote:
Original post by Wizardry
The acceleration due to gravity is based on the measurement system, metric is 9.8 m/(s^2) while english is 16 ft/(s^2).
Actually, in English units its roughly 32 ft/(s^2), .
quote:
Original post by Wizardry
Peace out.
Yes, peace.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
#8 Moderators  Reputation: 1365
Posted 29 June 2001  12:18 PM
quote:
Original post by python_regious
What do you mean by "English" units? We use metric in Britain.
Oops. I'm using the phrase "English Units" as we use it in America. Really it is the "U.S. Customary System of Units," which uses the avoidupois system of weights. Its related to the British Imperial system. When you really get down to it this is a bit complicated! The web page below provides some details, I guess:
http://www.encyclopedia.com/printablenew/04129.html
Anyway, regardless of the fact that you use the Metric system in Britain, apparently the phrase "English Units" refers always to use use of pounds, ounces, tons for weight, poundforce for force, foot per second squared for acceleration, inch, foot, yard for distance, etc. The thing that has changed over time is that now the basic "English" units are now actually defined in *terms* of Metric units (e.g., a yard is now defined to be some fractional number of meters) when they used to be defined some other way. Its strange. Here is a web page that compares the units of English and Metric units.
http://www.essex1.com/people/speer/units.html
This was actually a fairly fascinating question! I did some searching to reply, and I may still have some things wrong. I certainly hope you didn't take offense in my original postI believe I did use the term correctly.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Edited by  grhodes_at_work on June 29, 2001 7:19:46 PM
#10 Staff Emeritus  Reputation: 1983
Posted 01 July 2001  10:59 AM
Growing up in a former British colony, we were taught both the Imperial and Metric systems, and familiarized with both the terms "Imperial" and "English". Funny the British don''t teach that, since our curriculum is modeled exactly after the British (we even accept London and Cambridge GCEs).