diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-08 20:25:00 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-08 20:25:00 +0400 |
commit | 370850146f5ab1af11ec3a28abd1bad2f60314a4 (patch) | |
tree | 9559a67412bb0d78ef47bf05e19850357007fc19 /source/gameengine/Ketsji/KX_BulletPhysicsController.cpp | |
parent | 2074128fadbfd58ea13a68cbccaa1f6771bbd710 (diff) |
BGE patch #18051: add localInertia attribute to GameObject.
Diffstat (limited to 'source/gameengine/Ketsji/KX_BulletPhysicsController.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_BulletPhysicsController.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index 435b2b5db19..c621f11994a 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -162,6 +162,20 @@ MT_Scalar KX_BulletPhysicsController::GetMass() } +MT_Vector3 KX_BulletPhysicsController::GetLocalInertia() +{ + MT_Vector3 inertia(0.f, 0.f, 0.f); + btVector3 inv_inertia; + if (GetRigidBody()) { + inv_inertia = GetRigidBody()->getInvInertiaDiagLocal(); + if (!btFuzzyZero(inv_inertia.getX()) && + !btFuzzyZero(inv_inertia.getY()) && + !btFuzzyZero(inv_inertia.getZ())) + inertia = MT_Vector3(1.f/inv_inertia.getX(), 1.f/inv_inertia.getY(), 1.f/inv_inertia.getZ()); + } + return inertia; +} + MT_Scalar KX_BulletPhysicsController::GetRadius() { return MT_Scalar(CcdPhysicsController::GetRadius()); |