public static HkShape CreateCharacterShape(float height, float width, float headHeight, float headSize, float headForwardOffset, float downOffset = 0, bool capsuleForHead = false) { HkCapsuleShape capsule = new HkCapsuleShape(Vector3.Up * (height - downOffset) / 2.0f, Vector3.Down * (height) / 2.0f, width / 2.0f); if (headSize > 0) { HkConvexShape headShape; if (capsuleForHead) { headShape = new HkCapsuleShape(new Vector3(0, 0, -0.3f), new Vector3(0, 0, 0.3f), headSize); } else { headShape = new HkSphereShape(headSize); } //headShape = new HkCapsuleShape(new Vector3(0, 0, -0.05f), new Vector3(0, 0, 0.05f), headSize); HkShape[] shapes = new HkShape[] { capsule, new HkConvexTranslateShape(headShape, Vector3.Up * (headHeight - downOffset) / 2.0f + Vector3.Forward * headForwardOffset, HkReferencePolicy.TakeOwnership), }; return(new HkListShape(shapes, shapes.Length, HkReferencePolicy.TakeOwnership)); } else { return(capsule); } }
public static HkShape CreateCharacterShape(float height, float width, float headHeight, float headSize, float headForwardOffset, float downOffset = 0, bool capsuleForHead = false) { HkCapsuleShape capsule = new HkCapsuleShape(Vector3.Up * (height - downOffset) / 2.0f, Vector3.Down * (height) / 2.0f, width / 2.0f); if (headSize > 0) { HkConvexShape headShape; if (capsuleForHead) { headShape = new HkCapsuleShape(new Vector3(0, 0, -0.3f), new Vector3(0, 0, 0.3f), headSize); } else { headShape = new HkSphereShape(headSize); } //headShape = new HkCapsuleShape(new Vector3(0, 0, -0.05f), new Vector3(0, 0, 0.05f), headSize); HkShape[] shapes = new HkShape[] { capsule, new HkConvexTranslateShape(headShape, Vector3.Up * (headHeight - downOffset) / 2.0f + Vector3.Forward * headForwardOffset, HkReferencePolicy.TakeOwnership), }; return new HkListShape(shapes, shapes.Length, HkReferencePolicy.TakeOwnership); } else { return capsule; } }
protected override bool IsPositionValid(MyTransformD clientDelta) { if (m_character.Physics != null && m_character.Physics.CharacterProxy != null) { float offset = 2 * MyPerGameSettings.PhysicsConvexRadius + 0.03f; float width = (m_character.Definition.CharacterCollisionWidth * m_character.Definition.CharacterCollisionScale) - offset; float height = (m_character.Definition.CharacterCollisionHeight - m_character.Definition.CharacterCollisionWidth * m_character.Definition.CharacterCollisionScale) - offset; HkCapsuleShape capsule = new HkCapsuleShape(Vector3.Up * height / 2.0f, Vector3.Down * height / 2.0f, width / 2.0f); m_results.Clear(); clientDelta.Position = clientDelta.Position + m_character.WorldMatrix.Up * (m_character.Definition.CharacterCollisionHeight / 2 + offset); MyPhysics.GetPenetrationsShape(capsule, ref clientDelta.Position, ref clientDelta.Rotation, m_results, MyPhysics.CollisionLayers.DefaultCollisionLayer); bool otherFound = false; foreach (var colision in m_results) { if (colision.Body.Quality == HkCollidableQualityType.Character) { continue; } otherFound = true; } return(!otherFound); } return(false); }
public static HkShape CreateCharacterShape(float height, float width, float headHeight, float headSize, float headForwardOffset, float downOffset = 0f, bool capsuleForHead = false) { HkCapsuleShape shape = new HkCapsuleShape((Vector3.Up * (height - downOffset)) / 2f, (Vector3.Down * height) / 2f, width / 2f); if (headSize <= 0f) { return((HkShape)shape); } HkConvexShape childShape = !capsuleForHead ? ((HkConvexShape) new HkSphereShape(headSize)) : ((HkConvexShape) new HkCapsuleShape(new Vector3(0f, 0f, -0.3f), new Vector3(0f, 0f, 0.3f), headSize)); HkShape[] shapes = new HkShape[] { (HkShape)shape, (HkShape) new HkConvexTranslateShape(childShape, ((Vector3.Up * (headHeight - downOffset)) / 2f) + (Vector3.Forward * headForwardOffset), HkReferencePolicy.TakeOwnership) }; return((HkShape) new HkListShape(shapes, shapes.Length, HkReferencePolicy.TakeOwnership)); }
public static void DrawShape(HkShape shape, MatrixD worldMatrix, Color color, float alpha, bool shaded = true) { color.A = (byte)(alpha * 255f); if (shape.ShapeType != HkShapeType.Capsule) { MyRenderProxy.DebugDrawSphere(worldMatrix.Translation, 0.05f, color, 1f, false, false, true, false); } else { HkCapsuleShape shape2 = (HkCapsuleShape)shape; Vector3 vector = (Vector3)Vector3.Transform(shape2.VertexB, worldMatrix); MyRenderProxy.DebugDrawCapsule(Vector3.Transform(shape2.VertexA, worldMatrix), vector, shape2.Radius, color, false, false, false); } }
public static void InitCapsulePhysics(this IMyEntity entity, MyStringHash materialType, Vector3 vertexA, Vector3 vertexB, float radius, float mass, float linearDamping, float angularDamping, ushort collisionLayer, RigidBodyFlag rbFlag) { mass = (rbFlag & RigidBodyFlag.RBF_STATIC) != 0 ? 0 : mass; var physics = new Sandbox.Engine.Physics.MyPhysicsBody(entity, rbFlag) { MaterialType = materialType, AngularDamping = angularDamping, LinearDamping = linearDamping }; var massProperties = HkInertiaTensorComputer.ComputeSphereVolumeMassProperties(radius, mass); physics.ReportAllContacts = true; HkCapsuleShape shape = new HkCapsuleShape(vertexA, vertexB, radius); physics.CreateFromCollisionObject((HkShape)shape, (vertexA + vertexB) / 2, entity.PositionComp.WorldMatrix, massProperties); shape.Base.RemoveReference(); entity.Physics = physics; }
public static void InitCapsulePhysics(this IMyEntity entity, MyStringHash materialType, Vector3 vertexA, Vector3 vertexB, float radius, float mass, float linearDamping, float angularDamping, ushort collisionLayer, RigidBodyFlag rbFlag) { float single1 = mass; mass = ((rbFlag & RigidBodyFlag.RBF_STATIC) != RigidBodyFlag.RBF_DEFAULT) ? 0f : single1; MyPhysicsBody body1 = new MyPhysicsBody(entity, rbFlag); body1.MaterialType = materialType; body1.AngularDamping = angularDamping; body1.LinearDamping = linearDamping; MyPhysicsBody body = body1; HkMassProperties properties = HkInertiaTensorComputer.ComputeSphereVolumeMassProperties(radius, mass); body.ReportAllContacts = true; HkCapsuleShape shape = new HkCapsuleShape(vertexA, vertexB, radius); body.CreateFromCollisionObject((HkShape)shape, (vertexA + vertexB) / 2f, entity.PositionComp.WorldMatrix, new HkMassProperties?(properties), 15); shape.Base.RemoveReference(); entity.Physics = body; }
private void ThrustDamage() { if (m_flames.Count > 0 && MySession.Static.ThrusterDamage && Sync.IsServer && IsWorking && CubeGrid.InScene && CubeGrid.Physics != null && CubeGrid.Physics.Enabled) { if (CurrentStrength == 0 && !MyFakes.INACTIVE_THRUSTER_DMG) return; UpdateThrustFlame(); foreach (var flameInfo in m_flames) { var l = GetDamageCapsuleLine(flameInfo); HkShape shape; if (l.Length != 0) shape = new HkCapsuleShape(Vector3.Zero, l.To - l.From, flameInfo.Radius * BlockDefinition.FlameDamageLengthScale); else shape = new HkSphereShape(flameInfo.Radius * BlockDefinition.FlameDamageLengthScale); MyPhysics.GetPenetrationsShape(shape, ref l.From, ref Quaternion.Identity, m_flameCollisionsList, 0); shape.RemoveReference(); foreach (var obj in m_flameCollisionsList) { var ent = obj.GetCollisionEntity(); if (ent == null || ent.Equals(this)) continue; if (!(ent is MyCharacter)) ent = ent.GetTopMostParent(); if (m_damagedEntities.Contains(ent)) continue; else m_damagedEntities.Add(ent); if (ent is IMyDestroyableObject) (ent as IMyDestroyableObject).DoDamage(flameInfo.Radius * BlockDefinition.FlameDamage * 10, MyDamageType.Environment, true, attackerId: EntityId); else if (ent is MyCubeGrid) { var grid = ent as MyCubeGrid; if (grid.BlocksDestructionEnabled) { DamageGrid(flameInfo, l, grid); } } } m_damagedEntities.Clear(); m_flameCollisionsList.Clear(); } } }
private void ThrustDamage() { if (m_flames.Count > 0 && MySession.Static.ThrusterDamage && Sync.IsServer && IsWorking && CubeGrid.InScene && CubeGrid.Physics != null && CubeGrid.Physics.Enabled) { if (CurrentStrength == 0 && !MyFakes.INACTIVE_THRUSTER_DMG) { return; } UpdateThrustFlame(); foreach (var flameInfo in m_flames) { var l = GetDamageCapsuleLine(flameInfo); HkShape shape; if (l.Length != 0) { shape = new HkCapsuleShape(Vector3.Zero, l.To - l.From, flameInfo.Radius * m_thrustDefinition.FlameDamageLengthScale); } else { shape = new HkSphereShape(flameInfo.Radius * m_thrustDefinition.FlameDamageLengthScale); } MyPhysics.GetPenetrationsShape(shape, ref l.From, ref Quaternion.Identity, m_flameCollisionsList, 0); shape.RemoveReference(); foreach (var obj in m_flameCollisionsList) { var entity = obj.GetEntity(); if (entity == null) { continue; } if (entity.Equals(this)) { continue; } if (!(entity is MyCharacter)) { entity = entity.GetTopMostParent(); } if (m_damagedEntities.Contains(entity)) { continue; } else { m_damagedEntities.Add(entity); } if (entity is IMyDestroyableObject) { (entity as IMyDestroyableObject).DoDamage(flameInfo.Radius * m_thrustDefinition.FlameDamage * 10, MyDamageType.Environment, true); } else if (entity is MyCubeGrid && MySession.Static.DestructibleBlocks) { DamageGrid(flameInfo, l, entity as MyCubeGrid); } } m_damagedEntities.Clear(); m_flameCollisionsList.Clear(); } } }
/// <summary> /// Sets default values for ragdoll bodies and constraints - useful if ragdoll model is not correct /// </summary> public void SetRagdollDefaults() { if (MyFakes.ENABLE_RAGDOLL_DEBUG) { Debug.WriteLine("MyPhysicsBody.SetRagdollDefaults"); MyLog.Default.WriteLine("MyPhysicsBody.SetRagdollDefaults"); } var wasKeyframed = Ragdoll.IsKeyframed; Ragdoll.SetToDynamic(); // Compute total mass of the character and distribute it amongs ragdoll bodies var definedMass = (Entity as MyCharacter).Definition.Mass; if (definedMass <= 1) { definedMass = 80; } float totalVolume = 0f; foreach (var body in Ragdoll.RigidBodies) { float bodyLength = 0; var shape = body.GetShape(); Vector4 min, max; shape.GetLocalAABB(0.01f, out min, out max); bodyLength = (max - min).Length(); totalVolume += bodyLength; } // correcting the total volume if (totalVolume <= 0) { totalVolume = 1; } // bodies default settings foreach (var body in Ragdoll.RigidBodies) { body.MaxLinearVelocity = 1000.0f; body.MaxAngularVelocity = 1000.0f; var shape = body.GetShape(); Vector4 min, max; shape.GetLocalAABB(0.01f, out min, out max); float bodyLength = (max - min).Length(); float computedMass = definedMass / totalVolume * bodyLength; body.Mass = MyPerGameSettings.Destruction ? MyDestructionHelper.MassToHavok(computedMass) : computedMass; float radius = shape.ConvexRadius; if (shape.ShapeType == HkShapeType.Capsule) { HkCapsuleShape capsule = (HkCapsuleShape)shape; HkMassProperties massProperties = HkInertiaTensorComputer.ComputeCapsuleVolumeMassProperties(capsule.VertexA, capsule.VertexB, radius, body.Mass); body.InertiaTensor = massProperties.InertiaTensor; } else { HkMassProperties massProperties = HkInertiaTensorComputer.ComputeBoxVolumeMassProperties(Vector3.One * bodyLength * 0.5f, body.Mass); body.InertiaTensor = massProperties.InertiaTensor; } Debug.Assert(body.Mass != 0.0f, "Body's mass was set to 0!"); body.AngularDamping = 0.005f; body.LinearDamping = 0.0f; body.Friction = 6f; body.AllowedPenetrationDepth = 0.1f; body.Restitution = 0.05f; } Ragdoll.OptimizeInertiasOfConstraintTree(); if (wasKeyframed) { Ragdoll.SetToKeyframed(); } // Constraints default settings foreach (var constraint in Ragdoll.Constraints) { if (constraint.ConstraintData is HkRagdollConstraintData) { var constraintData = constraint.ConstraintData as HkRagdollConstraintData; constraintData.MaxFrictionTorque = MyPerGameSettings.Destruction ? MyDestructionHelper.MassToHavok(0.5f) : 3f; } else if (constraint.ConstraintData is HkFixedConstraintData) { var constraintData = constraint.ConstraintData as HkFixedConstraintData; constraintData.MaximumLinearImpulse = 3.40282e28f; constraintData.MaximumAngularImpulse = 3.40282e28f; } else if (constraint.ConstraintData is HkHingeConstraintData) { var constraintData = constraint.ConstraintData as HkHingeConstraintData; constraintData.MaximumAngularImpulse = 3.40282e28f; constraintData.MaximumLinearImpulse = 3.40282e28f; } else if (constraint.ConstraintData is HkLimitedHingeConstraintData) { var constraintData = constraint.ConstraintData as HkLimitedHingeConstraintData; constraintData.MaxFrictionTorque = MyPerGameSettings.Destruction ? MyDestructionHelper.MassToHavok(0.5f) : 3f; } } if (MyFakes.ENABLE_RAGDOLL_DEBUG) { Debug.WriteLine("MyPhysicsBody.SetRagdollDefaults FINISHED"); MyLog.Default.WriteLine("MyPhysicsBody.SetRagdollDefaults FINISHED"); } }
public static void InitCapsulePhysics(this IMyEntity entity, MyStringHash materialType, Vector3 vertexA, Vector3 vertexB, float radius, float mass, float linearDamping, float angularDamping, ushort collisionLayer, RigidBodyFlag rbFlag) { mass = (rbFlag & RigidBodyFlag.RBF_STATIC) != 0 ? 0 : mass; var physics = new Sandbox.Engine.Physics.MyPhysicsBody(entity, rbFlag) { MaterialType = materialType, AngularDamping = angularDamping, LinearDamping = linearDamping }; var massProperties = HkInertiaTensorComputer.ComputeSphereVolumeMassProperties(radius, mass); physics.ReportAllContacts = true; HkCapsuleShape shape = new HkCapsuleShape(vertexA, vertexB, radius); physics.CreateFromCollisionObject((HkShape)shape, (vertexA + vertexB) / 2, entity.PositionComp.WorldMatrix, massProperties); shape.Base.RemoveReference(); entity.Physics = physics; }
protected override bool IsPositionValid(MyTransformD clientDelta) { if (m_character.Physics != null && m_character.Physics.CharacterProxy != null) { float offset = 2 * MyPerGameSettings.PhysicsConvexRadius + 0.03f; float width = (m_character.Definition.CharacterCollisionWidth * m_character.Definition.CharacterCollisionScale) - offset; float height = (m_character.Definition.CharacterCollisionHeight - m_character.Definition.CharacterCollisionWidth * m_character.Definition.CharacterCollisionScale) - offset; HkCapsuleShape capsule = new HkCapsuleShape(Vector3.Up * height / 2.0f, Vector3.Down * height / 2.0f, width / 2.0f); m_results.Clear(); clientDelta.Position = clientDelta.Position + m_character.WorldMatrix.Up * (m_character.Definition.CharacterCollisionHeight/2 + offset); MyPhysics.GetPenetrationsShape(capsule, ref clientDelta.Position, ref clientDelta.Rotation, m_results, MyPhysics.CollisionLayers.DefaultCollisionLayer); bool otherFound = false; foreach (var colision in m_results) { if (colision.Body.Quality == HkCollidableQualityType.Character) { continue; } otherFound = true; } return !otherFound; } return false; }
public static unsafe void DrawCollisionShape(HkShape shape, MatrixD worldMatrix, float alpha, ref int shapeIndex, string customText = null, bool isPhantom = false) { Color color = GetShapeColor(shape.ShapeType, ref shapeIndex, isPhantom); if (isPhantom) { alpha *= alpha; } color.A = (byte)(alpha * 255f); bool smooth = true; float num = 0.02f; float num2 = 1.035f; bool flag2 = false; HkShapeType shapeType = shape.ShapeType; switch (shapeType) { case HkShapeType.Sphere: { float radius = ((HkSphereShape)shape).Radius; MyRenderProxy.DebugDrawSphere(worldMatrix.Translation, radius, color, alpha, true, smooth, true, false); if (isPhantom) { MyRenderProxy.DebugDrawSphere(worldMatrix.Translation, radius, color, 1f, true, false, true, false); MyRenderProxy.DebugDrawSphere(worldMatrix.Translation, radius, color, 1f, true, false, false, false); } flag2 = true; goto TR_0003; } case HkShapeType.Cylinder: { HkCylinderShape shape4 = (HkCylinderShape)shape; MyRenderProxy.DebugDrawCylinder(worldMatrix, shape4.VertexA, shape4.VertexB, shape4.Radius, color, alpha, true, smooth, false); flag2 = true; goto TR_0003; } case HkShapeType.Triangle: { HkTriangleShape shape12 = (HkTriangleShape)shape; MyRenderProxy.DebugDrawTriangle(shape12.Pt0, shape12.Pt1, shape12.Pt2, Color.Green, false, false, false); goto TR_0003; } case HkShapeType.Box: { HkBoxShape shape5 = (HkBoxShape)shape; MyRenderProxy.DebugDrawOBB(MatrixD.CreateScale((shape5.HalfExtents * 2f) + new Vector3(num)) * worldMatrix, color, alpha, true, smooth, true, false); if (isPhantom) { MyRenderProxy.DebugDrawOBB(Matrix.CreateScale((shape5.HalfExtents * 2f) + new Vector3(num)) * worldMatrix, color, 1f, true, false, true, false); MyRenderProxy.DebugDrawOBB(Matrix.CreateScale((shape5.HalfExtents * 2f) + new Vector3(num)) * worldMatrix, color, 1f, true, false, false, false); } flag2 = true; goto TR_0003; } case HkShapeType.Capsule: { HkCapsuleShape shape3 = (HkCapsuleShape)shape; MyRenderProxy.DebugDrawCapsule(Vector3.Transform(shape3.VertexA, worldMatrix), Vector3.Transform(shape3.VertexB, worldMatrix), shape3.Radius, color, true, smooth, false); flag2 = true; goto TR_0003; } case HkShapeType.ConvexVertices: { Vector3 vector; ((HkConvexVerticesShape)shape).GetGeometry(DebugGeometry, out vector); Vector3D vectord2 = Vector3D.Transform(vector, worldMatrix.GetOrientation()); MatrixD xd = worldMatrix; xd = MatrixD.CreateScale((double)num2) * xd; MatrixD *xdPtr1 = (MatrixD *)ref xd; xdPtr1.Translation -= vectord2 * (num2 - 1f); DrawGeometry(DebugGeometry, xd, color, true, true); flag2 = true; goto TR_0003; } case HkShapeType.TriSampledHeightFieldCollection: case HkShapeType.TriSampledHeightFieldBvTree: case HkShapeType.SampledHeightField: case HkShapeType.ExtendedMesh: case HkShapeType.Transform: case HkShapeType.CompressedMesh: case HkShapeType.Collection: case HkShapeType.User0: case HkShapeType.User1: case HkShapeType.User2: goto TR_0003; case HkShapeType.List: { HkShapeContainerIterator iterator = ((HkListShape)shape).GetIterator(); while (iterator.IsValid) { DrawCollisionShape(iterator.CurrentValue, worldMatrix, alpha, ref shapeIndex, customText, false); iterator.Next(); } goto TR_0003; } case HkShapeType.Mopp: DrawCollisionShape((HkShape)((HkMoppBvTreeShape)shape).ShapeCollection, worldMatrix, alpha, ref shapeIndex, customText, false); goto TR_0003; case HkShapeType.ConvexTranslate: { HkConvexTranslateShape shape7 = (HkConvexTranslateShape)shape; DrawCollisionShape((HkShape)shape7.ChildShape, Matrix.CreateTranslation(shape7.Translation) * worldMatrix, alpha, ref shapeIndex, customText, false); goto TR_0003; } case HkShapeType.ConvexTransform: { HkConvexTransformShape shape8 = (HkConvexTransformShape)shape; DrawCollisionShape((HkShape)shape8.ChildShape, shape8.Transform * worldMatrix, alpha, ref shapeIndex, customText, false); goto TR_0003; } case HkShapeType.StaticCompound: { HkStaticCompoundShape shape11 = (HkStaticCompoundShape)shape; if (DebugDrawFlattenHierarchy) { HkShapeContainerIterator iterator2 = shape11.GetIterator(); while (iterator2.IsValid) { if (shape11.IsShapeKeyEnabled(iterator2.CurrentShapeKey)) { object[] objArray1 = new object[4]; object[] objArray2 = new object[4]; objArray2[0] = customText ?? string.Empty; object[] local2 = objArray2; local2[1] = "-"; local2[2] = iterator2.CurrentShapeKey; local2[3] = "-"; string str = string.Concat(local2); DrawCollisionShape(iterator2.CurrentValue, worldMatrix, alpha, ref shapeIndex, str, false); } iterator2.Next(); } } else { for (int i = 0; i < shape11.InstanceCount; i++) { string str2; bool flag3 = shape11.IsInstanceEnabled(i); if (flag3) { object[] objArray3 = new object[4]; object[] objArray4 = new object[4]; objArray4[0] = customText ?? string.Empty; object[] local4 = objArray4; local4[1] = "<"; local4[2] = i; local4[3] = ">"; str2 = string.Concat(local4); } else { object[] objArray5 = new object[4]; object[] objArray6 = new object[4]; objArray6[0] = customText ?? string.Empty; object[] local6 = objArray6; local6[1] = "("; local6[2] = i; local6[3] = ")"; str2 = string.Concat(local6); } if (flag3) { DrawCollisionShape(shape11.GetInstance(i), shape11.GetInstanceTransform(i) * worldMatrix, alpha, ref shapeIndex, str2, false); } } } goto TR_0003; } case HkShapeType.BvCompressedMesh: break; case HkShapeType.BvTree: { HkGridShape shape13 = (HkGridShape)shape; if (HkGridShapeCellDebugDraw && !shape13.Base.IsZero) { float cellSize = shape13.CellSize; int shapeInfoCount = shape13.GetShapeInfoCount(); for (int i = 0; i < shapeInfoCount; i++) { try { Vector3S vectors; Vector3S vectors2; shape13.GetShapeInfo(i, out vectors, out vectors2, m_tmpShapeList); Vector3 position = (Vector3)(((vectors2 * cellSize) + (vectors * cellSize)) / 2f); Color color2 = color; if (vectors == vectors2) { color2 = new Color(1f, 0.2f, 0.1f); } MyRenderProxy.DebugDrawOBB((Matrix.CreateScale((((vectors2 * cellSize) - (vectors * cellSize)) + (Vector3.One * cellSize)) + new Vector3(num)) * Matrix.CreateTranslation(position)) * worldMatrix, color2, alpha, true, smooth, true, false); } finally { m_tmpShapeList.Clear(); } } } else { MyRenderMessageDebugDrawTriangles msgInterface = MyRenderProxy.PrepareDebugDrawTriangles(); try { using (HkShapeBuffer buffer = new HkShapeBuffer()) { HkShapeContainerIterator iterator3 = ((HkBvTreeShape)shape).GetIterator(buffer); while (iterator3.IsValid) { HkShape currentValue = iterator3.CurrentValue; if (currentValue.ShapeType != HkShapeType.Triangle) { DrawCollisionShape(currentValue, worldMatrix, alpha, ref shapeIndex, null, false); } else { HkTriangleShape shape17 = (HkTriangleShape)currentValue; msgInterface.AddTriangle(shape17.Pt0, shape17.Pt1, shape17.Pt2); } iterator3.Next(); } goto TR_0003; } } finally { msgInterface.Color = color; MyRenderProxy.DebugDrawTriangles(msgInterface, new MatrixD?(worldMatrix), false, false, false, false); } break; } goto TR_0003; } default: if (shapeType == HkShapeType.Bv) { HkBvShape shape19 = (HkBvShape)shape; DrawCollisionShape(shape19.BoundingVolumeShape, worldMatrix, alpha, ref shapeIndex, null, true); DrawCollisionShape(shape19.ChildShape, worldMatrix, alpha, ref shapeIndex, null, false); } else if (shapeType == HkShapeType.PhantomCallback) { MyRenderProxy.DebugDrawText3D(worldMatrix.Translation, "Phantom", Color.Green, 0.75f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } goto TR_0003; } if (MyDebugDrawSettings.DEBUG_DRAW_TRIANGLE_PHYSICS) { ((HkBvCompressedMeshShape)shape).GetGeometry(DebugGeometry); DrawGeometry(DebugGeometry, worldMatrix, Color.Green, false, false); flag2 = true; } TR_0003: if (flag2 && (customText != null)) { color.A = 0xff; MyRenderProxy.DebugDrawText3D(worldMatrix.Translation, customText, color, 0.8f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } }