예제 #1
0
    void OnDrawGizmos()
    {
        if (TimeElapsed >= Duration)
        {
            return;
        }

#if UNITY_EDITOR
        // This class have associated editor script. Don't interfere with it.
        if (UnityEditor.Selection.activeObject == gameObject)
        {
            return;
        }
#endif

        DebugHelper.UseGizmos = true;
        DebugHelper.DrawCircle(Origin, Radius, CircleColor);
        Gizmos.color = CenterPointColor;
        Gizmos.DrawSphere(Origin, 0.05f);

#if UNITY_EDITOR
        var contacts = lastFrameContacts.SelectMany(bodyAndContacts => bodyAndContacts.Value);

        foreach (var contact in contacts)
        {
            contact.DebugDraw();
        }
#endif

        DebugHelper.UseGizmos = false;
    }
예제 #2
0
    void FixedUpdate()
    {
        var p = ( Vector2 )transform.position + 1 * Vector2.right;

        DebugHelper.DrawCircle(p, 0.05f, Color.yellow);
        //var pVel = rigidbody2D.GetPointVelocity ( p );
        var pVel = GetPointVelocity(rigidbody2D, p);

        print(
            "pVel: " + pVel.ToString("G") +
            ", inertia: " + rigidbody2D.inertia
            );
    }
예제 #3
0
    public void DebugDraw(
        Color edgeColor, Color vertexColor,
        Transform transform,
        float duration = 0, bool depthTest = false
        )
    {
        if (Vertices.Count != 0)
        {
            var p0 = ( Vector2 )transform.TransformPoint(Vertices [Vertices.Count - 1]);

            for (int i = 0; i < Vertices.Count; i++)
            {
                var p1 = ( Vector2 )transform.TransformPoint(Vertices [i]);
                Debug.DrawLine(p0, p1, edgeColor, duration, depthTest);
                DebugHelper.DrawCircle(p0, 0.01f, vertexColor, 6);

                p0 = p1;
            }
        }
    }
예제 #4
0
파일: Spatial.cs 프로젝트: vsugrob/Wyrms
 public void DebugDraw(Color color)
 {
     DebugHelper.DrawRay(Point, Normal * NormalLength, color, 0, false);
     DebugHelper.DrawCircle(Point, 0.01f, Color.yellow);
 }