From 5849bcd270a3cb3613d030431f81f89e0abffc63 Mon Sep 17 00:00:00 2001 From: Vova Date: Sun, 16 Jul 2023 18:22:28 +0300 Subject: [PATCH] huh ? --- Assets/Scripts/Character.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index b14d49a..2b112d5 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -209,9 +209,9 @@ public abstract class Character : MonoBehaviour _facingRight = !_facingRight; } - static public RaycastHit2D BoxCast(Vector2 origen, Vector2 size, float angle, Vector2 direction, float distance, int mask) + static public RaycastHit2D BoxCast(Vector2 origin, Vector2 size, float angle, Vector2 direction, float distance, int mask) { - RaycastHit2D hit = Physics2D.BoxCast(origen, size, angle, direction, distance, mask); + RaycastHit2D hit = Physics2D.BoxCast(origin, size, angle, direction, distance, mask); //Setting up the points to draw the cast Vector2 p1, p2, p3, p4, p5, p6, p7, p8; @@ -228,10 +228,10 @@ public abstract class Character : MonoBehaviour p3 = q * p3; p4 = q * p4; - p1 += origen; - p2 += origen; - p3 += origen; - p4 += origen; + p1 += origin; + p2 += origin; + p3 += origin; + p4 += origin; Vector2 realDistance = direction.normalized * distance; p5 = p1 + realDistance; @@ -258,7 +258,8 @@ public abstract class Character : MonoBehaviour Debug.DrawLine(p4, p8, Color.grey); if (hit) { - Debug.DrawLine(hit.point, hit.point + hit.normal.normalized * 0.2f, Color.yellow); + var color = hit.point.x > origin.x ? Color.yellow : Color.cyan; + Debug.DrawLine(hit.point, hit.point + hit.normal.normalized * 0.2f, color); } return hit;