Browse Source

bullet: Allow intractions with bullet world during tick callbacks

        - Release the global lock during the user tick callback
        and allow interactions with bullet world
        - Acquire the lock again after the callback

Signed-off-by: deflected <[email protected]>
deflected 7 năm trước cách đây
mục cha
commit
1ac351d594
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      panda/src/bullet/bulletWorld.cxx

+ 5 - 0
panda/src/bullet/bulletWorld.cxx

@@ -1186,7 +1186,12 @@ tick_callback(btDynamicsWorld *world, btScalar timestep) {
   CallbackObject *obj = w->_tick_callback_obj;
   CallbackObject *obj = w->_tick_callback_obj;
   if (obj) {
   if (obj) {
     BulletTickCallbackData cbdata(timestep);
     BulletTickCallbackData cbdata(timestep);
+    // Release the global lock that we are holding during the tick callback
+    // and allow interactions with bullet world in the user callback
+    get_global_lock().release();
     obj->do_callback(&cbdata);
     obj->do_callback(&cbdata);
+    // Acquire the global lock again and protect the execution
+    get_global_lock().acquire();
   }
   }
 }
 }