Ferrous Moon
http://www.ferrousmoon.com:80/forums/

Physics (Gravity)
http://www.ferrousmoon.com:80/forums/viewtopic.php?f=45&t=1916
Page 2 of 2

Author:  eddieringle [Wed Sep 30, 2009 3:00 pm ]
Post subject:  Re: Physics (Gravity)

Quote:
If your player is at an angle, you would break the force into x and y components using sin and cos.
What?
EDIT: You mean xVel = cos(acceleration) and yVel = sin(acceleration)?

Also, what does fps stand for? Feet per second?
I understood pretty much everything else of that. :)

Author:  FinalWarrior [Wed Sep 30, 2009 3:18 pm ]
Post subject:  Re: Physics (Gravity)

Should be calculating and/or accelerating every frame, no?

-- Griffinhart

Author:  Soldier of Light [Wed Sep 30, 2009 9:26 pm ]
Post subject:  Re: Physics (Gravity)

FPS stands for frames per second. This is how fast your game runs. Usually to convert acceleration into velocity you need to multiply acceleration * time (since accel is m/s^2 and vel is just m/s). So we have frames/s, but we need s. So 1/fps is s/frame, which is perfect since all these calculations have just taken place in 1 frame. So therefore, 1/fps is just s, so doing accel/fps gives you velocity.

And yes, xaccel = accel*cos(angle) and yaccel = accel*sin(angle).

And yes, you are doing this calculation every frame, which is why you use the fps in converting accel to vel and vel to pos.

Page 2 of 2 All times are UTC-05:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/