Jump to content
• ### What is your GameDev Story?

• Advertisement

# please help with simple physics

This topic is 4928 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

##### 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

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 13
• 14
• 10
• 11
• 13
• Advertisement
• ### Forum Statistics

• Total Topics
634096
• Total Posts
3015488
×

## Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!