Example #1
0
        public void RefreshBlocks(HkRigidBody rigidBody, HkRigidBody rigidBody2, MyGridPhysics.MyDirtyBlocksInfo dirtyCubesInfo, HkdBreakableBody destructionBody = null)
        {
            ProfilerShort.Begin("Refresh shape");

            if (m_grid.Physics.HavokWorld != null)
                UnmarkBreakable(m_grid.Physics.HavokWorld, rigidBody);

            UpdateDirtyBlocks(dirtyCubesInfo.DirtyBlocks);
            UpdateMass(rigidBody);
            UpdateShape(rigidBody, rigidBody2, destructionBody);

            if (m_grid.Physics.HavokWorld != null)
                MarkBreakable(m_grid.Physics.HavokWorld, rigidBody);

            ProfilerShort.End();
        }
 private static bool IsDynamicGrid(HkRigidBody rb, MyGridPhysics grid)
 {
     return (grid != null && grid.RigidBody == rb && !grid.IsStatic);
 }
Example #3
0
        public void RefreshBlocks(HkRigidBody rigidBody, HkRigidBody rigidBody2, MyGridPhysics.MyDirtyBlocksInfo dirtyCubesInfo, HkdBreakableBody destructionBody = null)
        {
            ProfilerShort.Begin("Refresh shape");

            if (m_grid.Physics.HavokWorld != null)
                if (m_grid.BlocksDestructionEnabled)
                    UnmarkBreakable(m_grid.Physics.HavokWorld, rigidBody);

			m_originalMassPropertiesSet = false;
            UpdateDirtyBlocks(dirtyCubesInfo.DirtyBlocks);
            UpdateMass(rigidBody, false);
			UpdateMassFromInventories(m_grid.CubeBlocks, rigidBody.GetBody());
            UpdateShape(rigidBody, rigidBody2, destructionBody);

            if (m_grid.Physics.HavokWorld != null)
                if (m_grid.BlocksDestructionEnabled)
                    MarkBreakable(m_grid.Physics.HavokWorld, rigidBody);

            ProfilerShort.End();
        }