// Clone the world (except the colliders) public CollisionWorld Clone() { var clone = new CollisionWorld { m_Bodies = new NativeArray <RigidBody>(m_Bodies, Allocator.Persistent), Broadphase = (Broadphase)Broadphase.Clone(), EntityBodyIndexMap = new NativeHashMap <Entity, int>(m_Bodies.Length, Allocator.Persistent), }; clone.UpdateBodyIndexMap(); return(clone); }
// NOTE: // The BuildPhysicsWorld system updates the Body and Joint Index Maps. // If the PhysicsWorld is being setup and updated directly then // this UpdateIndexMaps function should be called manually as well. public void UpdateIndexMaps() { CollisionWorld.UpdateBodyIndexMap(); DynamicsWorld.UpdateJointIndexMap(); }