|
-
Sep 29th, 2003, 04:06 PM
#1
Thread Starter
Lively Member
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.
-
Sep 29th, 2003, 05:38 PM
#2
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.
-
Oct 2nd, 2003, 02:27 AM
#3
Fanatic Member
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.
-
Oct 2nd, 2003, 11:39 AM
#4
Addicted Member
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
-
Oct 2nd, 2003, 01:58 PM
#5
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|