Beispiel #1
0
        public static void DrawCapsule(Capsule3 capsule, Color colour)
        {
            Quaternion rotation       = Quaternion.LookRotation(capsule.Direction);
            Vector3    crossDirection = Vector3.Cross(Vector3.up, capsule.Direction);

            DrawCircularArc(capsule.InnerStartPoint, -capsule.Direction, capsule.Radius, 180f, Vector3.up, colour);
            DrawCircularArc(capsule.InnerStartPoint, -capsule.Direction, capsule.Radius, 180f, crossDirection, colour);
            DrawCircularArc(capsule.InnerEndPoint, capsule.Direction, capsule.Radius, 180f, Vector3.up, colour);
            DrawCircularArc(capsule.InnerEndPoint, capsule.Direction, capsule.Radius, 180f, crossDirection, colour);

            DrawCircularArc(capsule.InnerStartPoint, rotation * Vector3.up, capsule.Radius, 180f, capsule.Direction, colour);
            DrawCircularArc(capsule.InnerStartPoint, rotation * Vector3.down, capsule.Radius, 180f, capsule.Direction, colour);
            DrawCircularArc(capsule.InnerEndPoint, rotation * Vector3.up, capsule.Radius, 180f, capsule.Direction, colour);
            DrawCircularArc(capsule.InnerEndPoint, rotation * Vector3.down, capsule.Radius, 180f, capsule.Direction, colour);

            DrawLine(capsule.InnerStartPoint + (rotation * Vector3.up) * capsule.Radius, capsule.InnerEndPoint + (rotation * Vector3.up) * capsule.Radius, colour);
            DrawLine(capsule.InnerStartPoint + (rotation * Vector3.down) * capsule.Radius, capsule.InnerEndPoint + (rotation * Vector3.down) * capsule.Radius, colour);
            DrawLine(capsule.InnerStartPoint + (rotation * Vector3.left) * capsule.Radius, capsule.InnerEndPoint + (rotation * Vector3.left) * capsule.Radius, colour);
            DrawLine(capsule.InnerStartPoint + (rotation * Vector3.right) * capsule.Radius, capsule.InnerEndPoint + (rotation * Vector3.right) * capsule.Radius, colour);
        }
Beispiel #2
0
 public static void DrawCapsule(Capsule3 capsule)
 {
     DrawCapsule(capsule, Color.white);
 }