Get linear velocity at non-central point on a rigid body?
-
- Posts: 3
- Joined: Tue Oct 18, 2016 2:49 pm
Get linear velocity at non-central 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 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?
-
- Posts: 96
- Joined: Wed Mar 16, 2016 10:11 am
Re: Get linear velocity at non-central 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: 861
- Joined: Sun Jul 03, 2005 4:06 pm
- Location: Kirkland, WA
Re: Get linear velocity at non-central 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.