Get linear velocity at noncentral point on a rigid body?
Get linear velocity at noncentral point on a rigid body?
So as far as I know, rigidBody>getLinearVelocity() returns the velocity at the center of mass. So what if I have a swinging leverarm, 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 noncentral point on a rigid body
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);
It is not convenient, but it works.
getVelocity_relativeToCM_worldAxis(Vector3 positionRelativeToCM);
getVelocity_relativeToCM_shapeAxis(Vector3 positionRelativeToCM);
getVelocity_absolutePosition_worldAxis(Vector3 worldPosition);

 Posts: 873
 Joined: Sun Jul 03, 2005 4:06 pm
 Location: Kirkland, WA
Re: Get linear velocity at noncentral point on a rigid body
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.
btVector3 Lever= Point  Body>GetCenterOfMass();
btVector3 Velocity = Body>GetLinearVelocity() + btCross( Body>GetAngularVelocity, Lever);
I assume all points and velocities are in world space here.