Exemplo n.º 1
0
        // Clone the world
        public DynamicsWorld Clone()
        {
            DynamicsWorld clone = new DynamicsWorld
            {
                m_MotionDatas       = new NativeArray <MotionData>(m_MotionDatas.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory),
                m_MotionVelocities  = new NativeArray <MotionVelocity>(m_MotionVelocities.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory),
                m_NumMotions        = m_NumMotions,
                m_Joints            = new NativeArray <Joint>(m_Joints.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory),
                m_NumJoints         = m_NumJoints,
                EntityJointIndexMap = new NativeHashMap <Entity, int>(m_Joints.Length, Allocator.Persistent),
            };

            clone.m_MotionDatas.CopyFrom(m_MotionDatas);
            clone.m_MotionVelocities.CopyFrom(m_MotionVelocities);
            clone.m_Joints.CopyFrom(m_Joints);
            clone.UpdateJointIndexMap();
            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();
 }