public static DrawArrow ( |
||
origin | Origin point in world space. | |
endpoint | Endpoint in world space. | |
color | Color for Debug.Draw. | |
duration | float | Duration to show the arrow. |
return | void |
private static void DrawLineAndHits(RaycastHit2D[] hits, Vector2 origin, Vector2 endpoint) { DrawHitsForRaycasts(hits); Color drawColor = RaycastHitsContainHit(hits) ? HitCastColor : CastColor; DebugUtility.DrawArrow(origin, endpoint, drawColor); }
private static void DrawCircleCastAndHits( RaycastHit2D[] hits, Vector2 origin, float radius, Vector2 direction, float distance = Mathf.Infinity) { // Nothing to draw with a 0 radius or 0 distance if (Mathf.Approximately(radius, 0.0f) || Mathf.Approximately(distance, 0.0f)) { return; } // Just in case direction isn't normalized, do it now if (!Mathf.Approximately(direction.sqrMagnitude, 1.0f)) { direction.Normalize(); } DrawHitsForCirclecast(hits, radius); Color drawColor = RaycastHitsContainHit(hits) ? HitCastColor : CastColor; // Draw origin and end circles DebugUtility.DrawCircle(origin, radius, drawColor); Vector2 endCirclePosition = origin + (direction * distance); DebugUtility.DrawCircle(endCirclePosition, radius, drawColor); // Draw edges Vector2 radiusSegment = direction * radius; Vector2 orthoganalRadius = new Vector2(radiusSegment.y, -radiusSegment.x); DebugUtility.DrawArrow(origin + orthoganalRadius, endCirclePosition + orthoganalRadius, drawColor); DebugUtility.DrawArrow(origin - orthoganalRadius, endCirclePosition - orthoganalRadius, drawColor); }