#### Archived

This topic is now archived and is closed to further replies.

# Torque Rigid Body Dynamics

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

## Recommended Posts

i am trying to properly model the torque on a model. i have been reading a few different physics books and have come to this conclusion which i think is correct but i want to make sure for those who may have done this. let''s say there is a force vector (9,4,5) which states how much force is being exerted in each component direction. to find out how much torque it produces on an a model or body in the 3d world i would then calculate the cross product of the radial distance to the source of the force, (a vector from the origin of the model''s axis to the position of the force) with the force vector itself. is this correct? which means basically a force vector needs a position in the world as well as a vector showing how much force is exerted in each direction. so if that cross product gives the torque i would assume i could then properly calculate the angular acceleration by taking the resulting torque vector and dividing it by the model''s moment of inertia and i would have the resulting change in the angular velocity of my model. i would appreciate any comments. i am almost to the point where i have my code done so i can at least see what it looks like but i would appreciate any comments if anything is being done incorrectly. thanks

##### Share on other sites
that's pretty much it.

Torque = (P - O) ^ Force

P being the point of contact, O being a point on the axle, force being the force at the point of contact, all in world coordinates (or you can make them relative to the objects, but it's more work). So yes, you need to supply a point as well as a force, to apply a proper torque to the object. If you supply a force without a point, then the force is assumed to be exerted at the object's centre of mass. That is useful for gravity, or force fields, which does not give any torque (Am I correct? ).

to update the object's rotational component I do the following. This is stuff I got from websites, but it works a treat. Hope you don't mind quaternions It makes my life easier.

void Update(void){	//-------------------------------------------------------	// Accelerations 	//-------------------------------------------------------	m_LinAcceleration  = m_Forces  * m_InvMass;	m_RotAcceleration  = m_Torques * m_InvInertia;	//-------------------------------------------------------	// Euler Integration	//-------------------------------------------------------	m_Position += m_LinVelocity * m_dt + m_LinAcceleration * (m_dt*m_dt*0.5f);		//----------------------------------------------------------------------	// Poisot equation to integrate for orientation	//----------------------------------------------------------------------	Quaternion Qvel = Quaternion(m_RotVelocity, 0) * m_Q * 0.5f;	Quaternion Qaccel = Quaternion(m_RotAcceleration, 0) * m_Q * 0.5f;		m_Q += Qvel * m_dt + Qaccel * (m_dt*m_dt*0.5f); // standard euler equation, like for position	m_LinVelocity     += m_LinAcceleration * m_dt;	m_RotVelocity     += m_RotAcceleration * m_dt;		//-------------------------------------------------------	// setup final orientation	//-------------------------------------------------------	m_Q.Normalise();	//----------------------------------------------------------------------	// Convert orientation quaternion to matrix	//----------------------------------------------------------------------	m_Orientation = m_Q;		//----------------------------------------------------------------------	// Calculate world cordinate inverse inertia matrix	//----------------------------------------------------------------------	m_InvInertia = m_Orientation * m_InvBoxInertia * m_Orientation.Transpose();	//-----------------------------------------------------------------------	// Reset forces	//-----------------------------------------------------------------------	m_LinAcceleration	= Vector(0, 0, 0);	m_RotAcceleration	= Vector(0, 0, 0);	m_Forces			= Vector(0, 0, 0);	m_Torques			= Vector(0, 0, 0);}

m_RotVelocity, m_RotAccelerations are vectors, Qs are quaternions, and Inertias are 3x3 matrices, as well as m_Orientation.

[edited by - oliii on August 6, 2003 3:59:58 PM]

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 11
• 17
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632929
• Total Posts
3009278
• ### Who's Online (See full list)

There are no registered users currently online

×