Browse Source

bullet: sync rigid body transform when node is reparented

Reparenting a node will change its net transform, so it should cause a transform sync.

Fixes #629
rdb 6 years ago
parent
commit
f183d901cb
2 changed files with 15 additions and 0 deletions
  1. 14 0
      panda/src/bullet/bulletRigidBodyNode.cxx
  2. 1 0
      panda/src/bullet/bulletRigidBodyNode.h

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

@@ -359,6 +359,20 @@ do_transform_changed() {
   }
 }
 
+/**
+ *
+ */
+void BulletRigidBodyNode::
+parents_changed() {
+
+  if (_motion.sync_disabled()) return;
+
+  if (get_num_parents() > 0) {
+    LightMutexHolder holder(BulletWorld::get_global_lock());
+    do_transform_changed();
+  }
+}
+
 /**
  *
  */

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

@@ -112,6 +112,7 @@ public:
   void do_sync_b2p();
 
 protected:
+  virtual void parents_changed();
   virtual void transform_changed();
 
 private: