Browse Source

Fix for repeatedly scaling shapes.

enn0x 12 years ago
parent
commit
4a8e14bfbd
1 changed files with 3 additions and 1 deletions
  1. 3 1
      panda/src/bullet/bulletRigidBodyNode.cxx

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

@@ -86,6 +86,7 @@ void BulletRigidBodyNode::
 shape_changed() {
 shape_changed() {
 
 
   set_mass(get_mass());
   set_mass(get_mass());
+  transform_changed();
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -292,10 +293,11 @@ transform_changed() {
   if (ts->has_scale()) {
   if (ts->has_scale()) {
     btVector3 new_scale = LVecBase3_to_btVector3(ts->get_scale());
     btVector3 new_scale = LVecBase3_to_btVector3(ts->get_scale());
     btVector3 current_scale = _shape->getLocalScaling();
     btVector3 current_scale = _shape->getLocalScaling();
+    btVector3 current_scale_inv(1.0/current_scale.x(), 1.0/current_scale.y(), 1.0/current_scale.z());
 
 
     if (new_scale != current_scale) {
     if (new_scale != current_scale) {
+      _shape->setLocalScaling(current_scale_inv);
       _shape->setLocalScaling(new_scale);
       _shape->setLocalScaling(new_scale);
-      shape_changed();
     }
     }
   }
   }