Results 1 to 5 of 5

Thread: help with velocity related stuff

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Posts
    66

    help with velocity related stuff

    i'm making this simple game just to experiment w/ animation and physics and the like but i'm having trouble. i need gravity to act on the ship at all times but there is also thrust to counteract it. what equations do i need to calculate the x and y velocities and the amount that the ship should travel based on those values. thanks.

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Well, to get you started, this site (http://www.earth.ox.ac.uk/~tony/watts/formula1+2.html) will get you some equations for forces of gravity. If this doesn't need to be so exact, just use (whatevermassyoufeellike) / (distance between objects ^ 2). Play around with it to get whatever results you feel like.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Force is a vector, so take the two forces and add them together to get a resulting force. From there, use Newton's second law to get an acceleration.

    From there you should be able to get your resulting velocity.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  4. #4
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237

    Simpiler yet

    Gravity is just a vertical force, every time you move the object (a ship, right?) just subtract a constant (const GRAVITY = 9) from the Y position of the object.

    And if its also thrusting during that iteration, add whatever constant thrust should be, 10 or more if you want it to beat gravity and 9 if it shouldn't move, vertically, and less than 9 if you want it to fall slower. (play with all those numbers to see what works best for your game)

    That was entirly too long winded for the simplicity of this answer.

    Just because it doesn't follow the phsyics of this world doesn't mean it does work just as well.

    NOMAD

  5. #5
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Gravity may have a vertical force unless you deal with a space type environment where you have planets and other planetary objects that have their own independent gravitational fields.

    I believe the book is called Windows Game Programming for Dummies that has an example of such things.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width