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