瀏覽代碼

Enforce update of inertia tensor after shape or mass changes.

enn0x 14 年之前
父節點
當前提交
8c9bb7be1f
共有 2 個文件被更改,包括 8 次插入1 次删除
  1. 1 0
      panda/src/bullet/bulletRigidBodyNode.cxx
  2. 7 1
      panda/src/bullet/bulletSphericalConstraint.h

+ 1 - 0
panda/src/bullet/bulletRigidBodyNode.cxx

@@ -104,6 +104,7 @@ set_mass(float mass) {
   }
   }
 
 
   _rigid->setMassProps(mass, inertia);
   _rigid->setMassProps(mass, inertia);
+  _rigid->updateInertiaTensor();
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 7 - 1
panda/src/bullet/bulletSphericalConstraint.h

@@ -27,7 +27,13 @@ class BulletRigidBodyNode;
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : BulletSphericalConstraint
 //       Class : BulletSphericalConstraint
-// Description : 
+// Description : A constraint between two rigid bodies, each with a
+//               pivot point. The pivot points are described in the
+//               body's local space. The constraint limits movement
+//               of the two rigid bodies in such a way that the 
+//               pivot points match in global space. The spherical
+//               constraint can be seen as a "ball and socket"
+//               joint.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDABULLET BulletSphericalConstraint : public BulletConstraint {
 class EXPCL_PANDABULLET BulletSphericalConstraint : public BulletConstraint {