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; }
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 ); }
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; } } }
public void DebugDraw(Color color) { DebugHelper.DrawRay(Point, Normal * NormalLength, color, 0, false); DebugHelper.DrawCircle(Point, 0.01f, Color.yellow); }