Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Jumping over objects while in motion

  1. Oct 23, 2004 #1
    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 :cry:
     
  2. jcsd
  3. Oct 24, 2004 #2

    Galileo

    User Avatar
    Science Advisor
    Homework Helper

    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 [itex]y(t)=y_0t-\frac{1}{2}gt^2[/itex].

    For your game I think you'll have to tweak [itex]y_0[/itex] and g.
    A higher y0 means a more powerful jump.
    A higher g means a stronger gravitational field.
     
  4. Oct 24, 2004 #3
    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.
    To start with, set the y-vel to some positive value.
    (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! :biggrin:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?