示例#1
0
 public override void UpdateBeforeSimulation()
 {
     if (MyDebugDrawSettings.DEBUG_DRAW_TREE_COLLISION_SHAPES)
     {
         MyPhysicsComponentBase physics = base.Physics;
         if (physics != null)
         {
             HkRigidBody rigidBody = physics.RigidBody;
             if (rigidBody != null)
             {
                 int shapeIndex = 0;
                 MyPhysicsDebugDraw.DrawCollisionShape(rigidBody.GetShape(), physics.GetWorldMatrix(), 1f, ref shapeIndex, physics.IsActive ? "A" : "I", false);
             }
         }
     }
 }
        public static void DrawMountPoints(float cubeSize, MyCubeBlockDefinition def, ref MatrixD drawMatrix)
        {
            var mountPoints = def.GetBuildProgressModelMountPoints(1.0f);

            if (mountPoints == null)
            {
                return;
            }

            if (!MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AUTOGENERATE)
            {
                DrawMountPoints(cubeSize, def, drawMatrix, mountPoints);
            }
            else
            {   //Generate mount points from model collisions and draw them
                if (def.Model != null)
                {
                    int     index = 0;
                    MyModel model = VRage.Game.Models.MyModels.GetModel(def.Model);

                    foreach (var shape in model.HavokCollisionShapes)
                    {
                        MyPhysicsDebugDraw.DrawCollisionShape(shape, drawMatrix, 0.2f, ref index);
                    }

                    var newMountPoints = AutogenerateMountpoints(model, cubeSize);

                    DrawMountPoints(cubeSize, def, drawMatrix, newMountPoints.ToArray());
                }
            }

            if (MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS_HELPERS)
            {
                DrawMountPointsAxisHelpers(def, ref drawMatrix, cubeSize);
            }
        }