Example #1
0
    public static void DrawPlane(Plane plane, Vector3 centerPosition, Color color, float duration = 0, float length = 10.0f)
    {
#if UNITY_EDITOR
        // pick a valid tangent value
        Vector3 tangent = Vector3.Dot(plane.normal, Vector3.up) < 0.5f ? Vector3.up : Vector3.left;


        Vector3 t1 = Vector3.Cross(plane.normal, tangent).normalized;
        Vector3 t2 = Vector3.Cross(plane.normal, t1).normalized;

        Vector3 position = centerPosition;

        DebugExt.DrawCross(position, color, length / 10, duration);
        Debug.DrawLine(position + (t1 + t2) * length, position + (t1 - t2) * length, color, duration);
        Debug.DrawLine(position + (-t1 + t2) * length, position + (-t1 - t2) * length, color, duration);
        Debug.DrawLine(position + (t1 + t2) * length, position + (-t1 + t2) * length, color, duration);
        Debug.DrawLine(position + (t1 - t2) * length, position + (-t1 - t2) * length, color, duration);
#endif
    }
Example #2
0
 public void DebugDraw()
 {
     DebugExt.DrawCross((normal * distance).ToVector3(), Color.green, 1, 10);
 }