Jump to content
  • Advertisement
Sign in to follow this  
sakky

please help with simple physics

This topic is 4865 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Basically, I want some object flying around in 3D space. Their velocity & rotation is determined by using acceleration. Velocity is found by acceleration and rotation is found by using the magnitude of the velocity. If an object is moving fast, I want it to spin faster. This is what I have so far...
lpObject->vVel   = ( lpObject->vAcc * lpObject->fLastUpdate ) ;
fMagnitude	 = D3DXVec3Length( &lpObject->vVel ) ;
lpObject->vRot.x = ( fMagnitude * lpObject->fLastUpdate ) ;
lpObject->vRot.y = ( fMagnitude * lpObject->fLastUpdate ) ;
lpObject->vRot.z = ( fMagnitude * lpObject->fLastUpdate ) ;
lpObject->vPos  += lpObject->vVel ;

I haven't tried it out yet wit hactual models because I wanted to get the physics down first. So that should work, right?

Share this post


Link to post
Share on other sites
Advertisement
hmm I think this line:
lpObject->vVel   = ( lpObject->vAcc * lpObject->fLastUpdate ) ;

should be:
lpObject->vVel  += ( lpObject->vAcc * lpObject->fLastUpdate ) ;

I think that should work but you may want to scale the rotations (up or down) to make the rotation speed more reasonable, it depends how fast the object is going - remember 360degrees for a full turn so if its travelling at 360units-per-second then the object could appear not to be rotating - it all depends on units, frame-rate etc but just bear that in mind before assuming its not working.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!