/// <summary> /// Add shape for debug-information on the screen /// </summary> /// <param name="shape">Shape of the object</param> /// <param name="ori">Orientation</param> /// <param name="pos">Position</param> private void AddShapeToDrawList(Shape shape, JMatrix ori, JVector pos) { GeometricPrimitive primitive = null; Matrix scaleMatrix = Matrix.Identity; if (shape is BoxShape) { primitive = _primitives[(int)PrimitiveTypes.Box]; scaleMatrix = Matrix.CreateScale(Conversion.ToXnaVector((shape as BoxShape).Size)); } else if (shape is SphereShape) { primitive = _primitives[(int)PrimitiveTypes.Sphere]; scaleMatrix = Matrix.CreateScale((shape as SphereShape).Radius); } else if (shape is CylinderShape) { primitive = _primitives[(int)PrimitiveTypes.Cylinder]; CylinderShape cs = shape as CylinderShape; scaleMatrix = Matrix.CreateScale(cs.Radius, cs.Height, cs.Radius); } else if (shape is CapsuleShape) { primitive = _primitives[(int)PrimitiveTypes.Capsule]; CapsuleShape cs = shape as CapsuleShape; scaleMatrix = Matrix.CreateScale(cs.Radius * 2, cs.Length, cs.Radius * 2); } else if (shape is ConeShape) { ConeShape cs = shape as ConeShape; scaleMatrix = Matrix.CreateScale(cs.Radius, cs.Height, cs.Radius); primitive = _primitives[(int)PrimitiveTypes.Cone]; } else if (shape is ConvexHullShape) { ConvexHullShape cs = shape as ConvexHullShape; primitive = _primitives[(int)PrimitiveTypes.Box]; scaleMatrix = Matrix.CreateScale(Conversion.ToXnaVector(cs.BoundingBox.Max - cs.BoundingBox.Min)); } if (primitive != null) { primitive.AddWorldMatrix(scaleMatrix * Conversion.ToXnaMatrix(ori) * Matrix.CreateTranslation(Conversion.ToXnaVector(pos))); } }