# Get ball path based on angle and start/end point

• 01-18-2012, 08:09 AM
jerryjj
Get ball path based on angle and start/end point
hi,

If I know the start point and the end point of an object that has been 'launched', for instance a ball has been kicked in the air, and I know the angle with which it has been launched, would it then be possible to (roughly) describe the path that it followed (and the maximum height) and the velocity based on these values?

Ultimately I'd want to reproduce that path by tweening a line, so that the user can see how he kicked the ball...

Any tips and ideas and code examples are very welcome,

thanks,
Jerry.
• 01-19-2012, 05:25 AM
jerryjj
Actually i just want to know the maximum height that the ball has reached.

So the values I know are:
start point
end point
angle of launch

Is that possible if you don't know the initial velocity?
• 01-20-2012, 07:38 PM
realMakc
should be possible, let me try to solve it right here...
assuming you start at x=0, and land at x=r, given cc angle a, you have:
vy/vx = tan a,
y = vy * t - g * t * t,
x = vx * t.
put 3rd into 2nd:
y = x tan a - x^2 * (g / vx^2)
the height would be y when x=r/2:
h = (r/2) tan a - (r/2)^2 * (g / vx^2)
now to find (g / vx^2) remember that y(x=r)=0:
0 = r tan a - r^2 * (g / vx^2)
or
(g / vx^2) = (r tan a) / (r^2) = (tan a) / r
so, finally,
h = (r/2) tan a - (r/2)^2 * (tan a) / r = (r/2 - r/4) tan a = (r/4) * tan a
• 03-15-2012, 09:07 PM
_Ric_
Looks like you might have meant y = vy * t - 0.5 * g * t * t for that second equation, although you must have corrected it somewhere along the line because the final answer is correct: max height = tan(angle) * range / 4
• 03-16-2012, 05:00 AM
realMakc
yes, there should be 0.5 - my mistake

but since the final answer does not include g, it does not matter if you use g or 0.5g or 25g
• 03-16-2012, 07:02 AM
_Ric_
That's right - it's interesting because on first glance at that equation, it looks like the maximum height of a projectile is independent of gravity .... but of course it isn't, because the range is in turn dependent on gravity.