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

ray:Float

Radius of the circle.

x:Float

Horizontal position of the Circle center.

y:Float

Vertical position of the Circle center.

Methods

inlinecollideBounds(b:Bounds):Bool

Test if this Circle collides with the given Bounds b.

inlinecollideCircle(c:Circle):Bool

Tests if this Circle collides with the given Circle c.

contains(p:Point):Bool

Tests if Point p is inside this Circle.

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.

inlineside(p:Point):Float

Returns a squared distance between the Circle border and the given Point p.

Inherited Variables

Inherited Methods