What does btRigidBody::setCenterOfMassTransform do?
-
robagar
- Posts: 48
- Joined: Fri May 21, 2010 1:49 am
What does btRigidBody::setCenterOfMassTransform do?
.. and should I use it in place of btCollisionObject::setWorldTransform to reposition an object?
-
Flix
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: What does btRigidBody::setCenterOfMassTransform do?
Good question. From the Bullet source code:
So it seems that the second can handle static and kinematic bodies, interpolated velocities and, for some reasons, updates the inertia tensor too...
Code: Select all
void btCollisionObject::setWorldTransform(const btTransform& worldTrans)
{
m_worldTransform = worldTrans;
}Code: Select all
void btRigidBody::setCenterOfMassTransform(const btTransform& xform)
{
if (isStaticOrKinematicObject())
{
m_interpolationWorldTransform = m_worldTransform;
} else
{
m_interpolationWorldTransform = xform;
}
m_interpolationLinearVelocity = getLinearVelocity();
m_interpolationAngularVelocity = getAngularVelocity();
m_worldTransform = xform;
updateInertiaTensor();
}-
robagar
- Posts: 48
- Joined: Fri May 21, 2010 1:49 am
Re: What does btRigidBody::setCenterOfMassTransform do?
these interpolated velocities etc, are they used in continuous collision detection? I'm wondering if the intention is to use this function with btContinuousDynamicsWorld (when it's finished
)
-
Flix
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: What does btRigidBody::setCenterOfMassTransform do?
I honestly don' know it... Maybe interpolated velocities are just used to calculate interpolated transforms during "interpolated" physic timesteps (when stepSimulation() is called with a delta time < Bullet timestep).robagar wrote:these interpolated velocities etc, are they used in continuous collision detection? I'm wondering if the intention is to use this function with btContinuousDynamicsWorld (when it's finished)