# Jumping over objects while in motion

1. Oct 23, 2004

### kool_j

Hi,
I'm in the process of designing a PC game and I need to make objectA ,which is driving along to jump over object B which is stationary in its path. Can anyone tell if there is a formula to work out this type of motion.
Thanks

2. Oct 24, 2004

### Galileo

A simplistic way to do it would be to assume the jumper is like rigid body and follows a parabolic path while in the air. Let's call the direction in which the jumper is running the x-direction and up will be the y-direction.
Then when jumping, the x-component of the velocity will not change.
For the y-direction, you'll have to know how high he/she will jump, which is determined by it's initial velocity in the y-direction. Let's call it y0.
Then $y(t)=y_0t-\frac{1}{2}gt^2$.

For your game I think you'll have to tweak $y_0$ and g.
A higher y0 means a more powerful jump.
A higher g means a stronger gravitational field.

3. Oct 24, 2004

I assume youre looking at the object thats jumping from side on right?
(Like a Platformer) I also assume that you must be keeping its x, y
velocities independent from each other.

y

|
|
|
|________ x

If thats the case, keep your x-velocity constant as the jump is made.
(yVel = startYVal)
(This will set how high you want to jump)
As time passes, change your y-velocity as follows:
yVel = oldYVel - g*t**2,
(where t is time and g is some constant that will set your gravity)
When yVel == - startYVal, then set yVal to 0 and end your loop.
(Otherwise your character will just fall straight through the platform)

This should give you a nice parabollic shape for your jump.

Sorry... I couldn't think of any simpler terms to explain this in.
Enjoy making the game!