The circular hitbox implementation of a 2D Collider.
Constructor
inlinenew(x:Float, y:Float, ray:Float)
Create new Circle collider.
Parameters:
x | X position of the Circle center. |
---|---|
y | Y position of the Circle center. |
ray | Radius of the circle. |
Variables
Methods
inlinedistanceSq(p:Point):Float
Returns a squared distance between the Circle center and the given Point p
.
inlinelineIntersect(p1:Point, p2:Point):Array<Point>
Tests if this Circle intersects with a line segment from Point p1
to Point p2
.
Returns:
An array of Points with intersection coordinates.
Contains 1 Point if line intersects only once or 2 points if line enters and exits the circle.
If no intersection is found, returns null
.