예제 #1
0
        static public bool IsIntersectingLine(this Face item, Ray2 ray, out float distance, out Vector2 point)
        {
            bool did_intersect = ray.IsIntersectingLine(item.v0, item.normal, out distance);

            point = ray.GetPointAlong(distance);
            return(did_intersect && point.IsBoundBetween(item.v0, item.v1));
        }
예제 #2
0
        static public bool IsIntersecting(this Plane2 item, Ray2 ray, out Vector2 point)
        {
            float distance;
            bool  did_intersect = item.IsIntersecting(ray, out distance);

            point = ray.GetPointAlong(distance);
            return(did_intersect);
        }
예제 #3
0
        static public bool IsIntersecting(this Plane2 item, Ray2 ray, out float distance)
        {
            if (item.IsIntersectingLine(ray, out distance) && distance >= 0.0f)
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        static public bool CircleCast(this Ray2 item, float radius, out RaycastHit2D hit, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS)
        {
            hit = Physics2D.CircleCast(item.origin, radius, item.direction, max_distance, layer_mask);
            if (hit.DidHit())
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
        static public bool Cast(this Ray2 item, out RaycastHit2D hit, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS)
        {
            hit = item.CastGetHit(max_distance, layer_mask);
            if (hit.DidHit())
            {
                return(true);
            }

            return(false);
        }
예제 #6
0
        static public bool IsIntersecting(this Face item, Ray2 ray, out float distance, out Vector2 point)
        {
            if (item.IsIntersectingLine(ray, out distance, out point) && distance >= 0.0f)
            {
                return(true);
            }

            distance = float.MaxValue;
            return(false);
        }
예제 #7
0
        static public bool IsIntersectingLine(this Ray2 item, Vector2 point, Vector2 normal, out float offset)
        {
            float ray_normal_length = -normal.GetDot(item.direction);
            float normal_distance   = normal.GetDot(item.origin - point);

            offset = normal_distance / ray_normal_length;
            if (offset > float.MinValue && offset < float.MaxValue)
            {
                return(true);
            }

            return(false);
        }
예제 #8
0
        static public bool IsIntersectingLine(this Face item, Ray2 ray, out float distance)
        {
            Vector2 point;

            return(item.IsIntersectingLine(ray, out distance, out point));
        }
예제 #9
0
 static public Vector2 GetPointAlong(this Ray2 item, float distance)
 {
     return(item.origin + item.direction * distance);
 }
예제 #10
0
 static public void DrawRay(Ray2 ray)
 {
     DrawRay(ray, 0.3f);
 }
예제 #11
0
 static public IEnumerable <RaycastHit2D> CircleCastGetAllHits(this Ray2 item, float radius, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS)
 {
     return(Physics2DExtensions.CircleCastAll(item.origin, item.direction, radius, max_distance, layer_mask));
 }
예제 #12
0
 static public RaycastHit2D CircleCastGetHit(this Ray2 item, float radius, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS)
 {
     return(Physics2D.CircleCast(item.origin, radius, item.direction, max_distance, layer_mask));
 }
예제 #13
0
        static public bool CircleCast(this Ray2 item, float radius, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS)
        {
            RaycastHit2D hit;

            return(item.CircleCast(radius, out hit, max_distance, layer_mask));
        }
예제 #14
0
 static public float FindLargestFixedEdgeCircleCast(this Ray2 item, float distance, float maximum, int layer_mask = IntBits.ALL_BITS, float margin = Mathq.DEFAULT_SOLVE_MARGIN, int max_iterations = Mathq.DEFAULT_SOLVE_MAX_NUMBER_ITERATIONS)
 {
     return(Physics2DExtensions.FindLargestFixedEdgeCircleCast(item.origin, item.direction, distance, maximum, layer_mask, margin, max_iterations));
 }
예제 #15
0
 static public bool IsIntersectingLine(this Plane2 item, Ray2 ray, out float distance)
 {
     return(ray.IsIntersectingLine(item.GetOrigin(), item.normal, out distance));
 }
예제 #16
0
        static public bool IsIntersecting(this Face item, Ray2 ray, out Vector2 point)
        {
            float distance;

            return(item.IsIntersecting(ray, out distance, out point));
        }
예제 #17
0
 static public void DrawRay(Ray2 ray, float size)
 {
     DrawVectorArrow(ray.origin, ray.direction, size);
 }