Example #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));
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #8
0
        static public bool IsIntersectingLine(this Face item, Ray2 ray, out float distance)
        {
            Vector2 point;

            return(item.IsIntersectingLine(ray, out distance, out point));
        }
Example #9
0
 static public Vector2 GetPointAlong(this Ray2 item, float distance)
 {
     return(item.origin + item.direction * distance);
 }
Example #10
0
 static public void DrawRay(Ray2 ray)
 {
     DrawRay(ray, 0.3f);
 }
Example #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));
 }
Example #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));
 }
Example #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));
        }
Example #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));
 }
Example #15
0
 static public bool IsIntersectingLine(this Plane2 item, Ray2 ray, out float distance)
 {
     return(ray.IsIntersectingLine(item.GetOrigin(), item.normal, out distance));
 }
Example #16
0
        static public bool IsIntersecting(this Face item, Ray2 ray, out Vector2 point)
        {
            float distance;

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