The collider associated for this shape, if any.
Position of the circle relative to the collider, by default (0, 0) meaning the shape is positioned on top of the collider.
This is the radius of the circle
Get axis not implemented on circles, since there are infinite axis in a circle
Get the axis aligned bounding box for the circle shape in world coordinates
Get the center of the collision shape in world coordinates
Returns the moment of inertia of a circle given it's mass https://en.wikipedia.org/wiki/List_of_moments_of_inertia
Get the axis aligned bounding box for the circle shape in local coordinates
Returns a clone of this shape, not associated with any collider
Tests if a point is contained in this collision shape
Project the circle along a specified axis
Tests the separating axis theorem for circles against polygons
This is a circle collision shape for the excalibur rigid body physics simulation
Example:
Circle Collision Shape
Excalibur has a Shape static helper to create circles for collisions in your game.
The default shape for a collider is a box, however a custom circle shape and collider can be created for an actor body.
This example creates a circle of
radius = 50
.const circle = new ex.Actor({ pos: new ex.Vector(400, 400), color: ex.Color.Red, body: new ex.Body({ collider: new ex.Collider({ shape: ex.Shape.Circle(50) type: ex.CollisionType.Active; }) }) });