ewjordan wrote:
Ah, ok, right on, that's correct at all times, sorry, I misinterpreted what you were solving for (I thought x and y here were at the vertex of the parabola).
You're not done yet, though, because you still need to solve that expression for the maximum to find the peak (err, vertex, if we're using proper terminology). Which means we just set dy/dx = 0 and see what falls out:
dy/dx = vy/vx - g x(peak) / vx^2 == 0
=>
vy/vx = g*x(peak)/vx^2
vy = g*x(peak) / vx
or
x(peak) = vy * vx / g
(which, thankfully, matches the expression I gave earlier - always good to double check these things).
From there, you proceed as I mentioned, plugging in that x value to the y expression and simplifying.
This still assumes, of course, that you're setting the parameters based on the desired vertex of the parabola.
I got it.
Use the ewjordan's formula:
Code:
vy/vx = g*x(peak)/vx^2
vy = g*x(peak) / vx
I calculated the vx and vy.Using vx and vy, I got the x and y value of each time step.So I can draw the parabola curve.
And setting the body's lineDamping to zero, the body will follow thep arabola curve to move.
Thank you,ewjordan.
And thank you all your guys.
There is another question:how to create a hollow body, such as a empty circle ?