This commit is contained in:
Irlan
2018-07-24 16:46:28 -03:00
parent bea108510f
commit 927b35a45d
2 changed files with 29 additions and 19 deletions

View File

@ -152,6 +152,9 @@ public:
// Get the local position of the center of mass.
b3Vec3 GetLocalCenter() const;
// Get the velocity at a given point.
b3Vec3 GetPointVelocity(const b3Vec3& point) const;
// Get the linear velocity of the center of mass.
b3Vec3 GetLinearVelocity() const;
@ -556,6 +559,11 @@ inline void b3Body::SetGravityScale(float32 scale)
}
}
inline b3Vec3 b3Body::GetPointVelocity(const b3Vec3& point) const
{
return m_linearVelocity + b3Cross(m_angularVelocity, point - m_sweep.worldCenter);
}
inline b3Vec3 b3Body::GetLinearVelocity() const
{
return m_linearVelocity;