A Flash Developer Resource Site

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

1. ## 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.

2. 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?

3. 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

4. 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

5. 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

6. 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.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap

Click Here to Expand Forum to Full Width