Page 1 of 1

Get linear velocity at non-central point on a rigid body?

Posted: Tue Nov 21, 2017 8:33 am
by sak
So as far as I know, rigidBody->getLinearVelocity() returns the velocity at the center of mass. So what if I have a swinging lever-arm, and I want to calculate the velocity at point at the end of the lever arm? Is there a convenient way to do this?

Re: Get linear velocity at non-central point on a rigid body

Posted: Tue Nov 21, 2017 12:38 pm
by hyyou
I totally encapsulated Bullet, and coded such functions myself.
It is not convenient, but it works.

getVelocity_relativeToCM_worldAxis(Vector3 positionRelativeToCM);
getVelocity_relativeToCM_shapeAxis(Vector3 positionRelativeToCM);
getVelocity_absolutePosition_worldAxis(Vector3 worldPosition);

Re: Get linear velocity at non-central point on a rigid body

Posted: Tue Nov 21, 2017 9:11 pm
by Dirk Gregorius
The velocity of any point on the rigid body can easily be computed like this:

btVector3 Lever= Point - Body->GetCenterOfMass();
btVector3 Velocity = Body->GetLinearVelocity() + btCross( Body->GetAngularVelocity, Lever);

I assume all points and velocities are in world space here.