How to change speed without changing path travelled?

Posted by Ben Williams on Game Development See other posts from Game Development or by Ben Williams
Published on 2011-02-01T00:57:13Z Indexed on 2011/02/01 7:33 UTC
Read the original article Hit count: 336

Filed under:

I have a ball which is being thrown from one side of a 2D space to the other. The formula I am using for calculating the ball's position at any one point in time is:

x = x0 + vx0*t
y = y0 + vy0*t - 0.5*g*t*t

where g is gravity, t is time, x0 is the initial x position, vx0 is the initial x velocity.

What I would like to do is change the speed of this ball, without changing how far it travels. Let's say the ball starts in the lower left corner, moves upwards and rightwards in an arc, and finishes in the lower right corner, and this takes 5s. What I would like to be able to do is change this so it takes 10s or 20s, but the ball still follows the same curve and finishes in the same position.

How can I achieve this? All I can think of is manipulating t but I don't think that's a good idea. I'm sure it's something simple, but my maths is pretty shaky.

© Game Development or respective owner

Related posts about 2d-physics