Thanks for replying.
Zoomulator wrote:
...Many old pool games has this feature to let the player aim the pool balls with a bit more ease...
What is it exactly you're trying to do? What's the game about and what is the use of this feature?
It is very simple, just like you said "the pool games", i just want to let the player throw some bodies to a basket, once time a body, all other things are static.The bodies have different attributes, such as initial position,velocity,mass etc.So I want to give the player some clue to adjust the direction and aim at the basket before he throw the body.
The body simulate parabolic movement, I give it a horizontal velocity and a vertical velocity, then I calculate the movement path.The result is that the path I got doesn't match the actual one.Then I print the actual path, got the curve by calculating three points.I found the horizontal velocity kept the same as I assumed, but the vertical velocity changed.
The formulas as fallowed:
x = vx * t
y = vy * t - 1/2 * g * t^2
vx is horizontal velocity, vy is vertical velocity, g is gravity.
replace the t in the 2nd formula, then i got:
y = vy/vx * x - 1/2 * g *x^2 / vx^2
I assume vx = -50, vy = 40, g=10
then i use the actual path's three points:(318,142),(130.5,217),(30.5,199.5)
and the general parabolic curve:y = a * x^2 + b * x + c, i got
y = -0.002 * x^2 + 0.497 * x + 186.202
so i got:
-0.002 = -1/2 * g / vx^2 ---> vx^2 = g / 0.004 = 2500 ---> vx = 50
0.497 = vy / vx ---> vy = 0.497 * vx ---> vy = 24.75
the actual vertical velocity doest't equal the one i assumed.
I don't know what's wrong.
is there air damp or something else?