Shape
Index
Constructors
constructor
Returns Shape
Methods
staticBox
Creates a box collider, under the hood defines a PolygonCollider collider
Parameters
width: number
Width of the box
height: number
Height of the box
anchor: Vector = Vector.Half
Anchor of the box (default (.5, .5)) which positions the box relative to the center of the collider's position
offset: Vector = Vector.Zero
Optional offset relative to the collider in local coordinates
Returns PolygonCollider
staticCapsule
Creates a new capsule shaped CompositeCollider using 2 circles and a box
Capsule colliders are useful for platformers with incline or jagged floors to have a smooth player experience.
Parameters
width: number
height: number
offset: Vector = Vector.Zero
Optional offset
Returns CompositeCollider
staticCircle
Creates a new
circle
colliderCircle colliders are useful for balls, or to make collisions more forgiving on sharp edges
Parameters
radius: number
Radius of the circle collider
offset: Vector = Vector.Zero
Optional offset relative to the collider in local coordinates
Returns CircleCollider
staticEdge
Creates a new
edge
colliderEdge colliders are useful for floors, walls, and other barriers
Parameters
begin: Vector
Beginning of the edge in local coordinates to the collider
end: Vector
Ending of the edge in local coordinates to the collider
Returns EdgeCollider
staticPolygon
Creates a new
arbitrary polygon
colliderPolygonColliders are useful for creating convex polygon shapes
Parameters
points: Vector[]
Points specified in counter clockwise
offset: Vector = Vector.Zero
Optional offset relative to the collider in local coordinates
suppressConvexWarning: boolean = false
Returns PolygonCollider
Excalibur helper for defining colliders quickly