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

## 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 on other sites
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.

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 17
• 18
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633362
• Total Posts
3011528
• ### Who's Online (See full list)

There are no registered users currently online

×