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

Post Reply
sak
Posts: 3
Joined: Tue Oct 18, 2016 2:49 pm

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

Post by sak » Tue Nov 21, 2017 8:33 am

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?

hyyou
Posts: 61
Joined: Wed Mar 16, 2016 10:11 am

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

Post by hyyou » Tue Nov 21, 2017 12:38 pm

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);

Dirk Gregorius
Posts: 873
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

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

Post by Dirk Gregorius » Tue Nov 21, 2017 9:11 pm

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.

Post Reply