applyTorqueImpulse and applyTorque, whats the difference ?

Post Reply
luke.titley
Posts: 15
Joined: Fri Sep 08, 2006 3:39 pm

applyTorqueImpulse and applyTorque, whats the difference ?

Post by luke.titley »

Hey, what's the difference between the applyTorqueImpulse and the applyTorque methods in an btRigidBody ?

I have the Examples, User Manual and Doxygen Output.
I there any other documentation I am missing?

Thanks.

Luke
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Post by bone »

The word impulse in physics typically means an instantaneous velocity and/or rotation change.

I can't comment directly about the API because I'm not an experienced user (yet). My initial assumption would be that applyTorque() will apply the given torque (given in units such as Nm) over the next timestep, whereas applyTorqueImpulse will apply the given input (possibly in units such as Nms?) will be applied immediately, changing the current angular momentum and rotation.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Post by Erwin Coumans »

This is correct. The applyTorqueImpuse changes the angular velocity directly, whereas applyTorque the torque accumulates and applies at the next simulation step:

Code: Select all

void applyTorqueImpulse(const btVector3& torque)
        {
                        m_angularVelocity += m_invInertiaTensorWorld * torque;
        }
and

Code: Select all

void   applyTorque(const btVector3& torque)
{
          m_totalTorque += torque;
}
Similar to applyImpulse and applyForce.

Hope this helps,
Erwin
luke.titley
Posts: 15
Joined: Fri Sep 08, 2006 3:39 pm

Post by luke.titley »

Yes it does, thanks.
There's a tiny inconsistency in the naming of the SetLimit method in btGeneric6DofConstraint.
It starts with a capitol.

Luke
Post Reply