Parameter to getVelocityInLocalPoint

jamesm6162
Posts: 6
Joined: Fri Mar 23, 2012 7:18 am

Parameter to getVelocityInLocalPoint

Post by jamesm6162 »

Hi all

The rel_pos parameter of the btRigidBody::getVelocityInLocalPoint is a little ambiguous (at least to me)
Should the point be a world-space offset of the point from the rigid body center of mass, or should it be transformed to the rigid body's local space.

In other words, given the following point in world space, which option is the correct way of determining the body's velocity at this point:

Code: Select all

btRigidBody rb;
// The point in world space
btVector3 world_pos = ...;
// relative position in world space
btVector3 rel_pos = world_pos - rb.getCenterOfMassPosition();
btVector3 velocity;

// OPTION A.
velocity = rb.getVelocityInLocalPoint(rel_pos);
// OPTION B.
btVector3 local_point = rb.getCenterOfMassTransform().getBasis().transpose() * rel_pos;
velocity = rb.getVelocityInLocalPoint(local_point);
Thanks