Explorar el Código

world: check whether actor has motion state

Daniele Bartolini hace 8 años
padre
commit
ef3036b19c
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/world/physics_world_bullet.cpp

+ 3 - 1
src/world/physics_world_bullet.cpp

@@ -875,7 +875,9 @@ struct PhysicsWorldImpl
 			const Quaternion rot = rotation(*begin_world);
 			const Vector3 pos = translation(*begin_world);
 			// http://www.bulletphysics.org/mediawiki-1.5.8/index.php/MotionStates
-			_actor[ai].actor->getMotionState()->setWorldTransform(btTransform(to_btQuaternion(rot), to_btVector3(pos)));
+			btMotionState* ms = _actor[ai].actor->getMotionState();
+			if (ms)
+				ms->setWorldTransform(btTransform(to_btQuaternion(rot), to_btVector3(pos)));
 		}
 	}