ColliderComponent
Hierarchy
- Component
- ColliderComponent
Index
Constructors
constructor
Parameters
optionalcollider: Collider
Returns ColliderComponent
Properties
public$colliderAdded
Observable that notifies when a collider is added to the body
public$colliderRemoved
Observable that notifies when a collider is removed from the body
optionalreadonlydependencies
Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity
Only components with zero-arg constructors are supported as automatic component dependencies
publicevents
optionalowner
Current owning [[Entity]], if any, of this component. Null if not added to any [[Entity]]
Accessors
publicbounds
Return world space bounds
Returns BoundingBox
publiclocalBounds
Return local space bounds
Returns BoundingBox
Methods
publicclear
Remove collider geometry from collider component
Returns void
publicclone
Clones any properties on this component, if that property value has a
clone()
method it will be calledReturns ColliderComponent
collide
Collide component with another
Parameters
other: ColliderComponent
Returns CollisionContact[]
publicget
Get the current collider geometry
Returns Collider
onAdd
Optional callback called when a component is added to an entity
Parameters
entity: Entity<any>
Returns void
onRemove
Optional callback called when a component is removed from an entity
Returns void
publicprocessColliderRemoval
Returns void
publicset
Set the collider geometry
Type parameters
- T: Collider
Parameters
collider: T
Returns T
the collider you set
publicupdate
Update the collider's transformed geometry
Returns void
useBoxCollider
Sets up a box geometry based on the current bounds of the associated actor of this physics body.
If no width/height are specified the body will attempt to use the associated actor's width/height.
By default, the box is center is at (0, 0) which means it is centered around the actors anchor.
Parameters
Returns PolygonCollider
useCircleCollider
Sets up a [[Circle|circle collision geometry]] as the only collider with a specified radius in pixels.
By default, the box is center is at (0, 0) which means it is centered around the actors anchor.
Parameters
radius: number
center: Vector = Vector.Zero
Returns CircleCollider
useCompositeCollider
Setups up a [[CompositeCollider]] which can define any arbitrary set of excalibur colliders
Parameters
colliders: Collider[]
Returns CompositeCollider
useEdgeCollider
Sets up an [[Edge|edge collision geometry]] with a start point and an end point relative to the anchor of the associated actor of this physics body.
By default, the box is center is at (0, 0) which means it is centered around the actors anchor.
Parameters
Returns EdgeCollider
usePolygonCollider
Sets up a [[PolygonCollider|polygon]] collision geometry based on a list of of points relative to the anchor of the associated actor of this physics body.
Only convex polygon definitions are supported.
By default, the box is center is at (0, 0) which means it is centered around the actors anchor.
Parameters
Returns PolygonCollider
Components are containers for state in Excalibur, the are meant to convey capabilities that an Entity possesses
Implementations of Component must have a zero-arg constructor to support dependencies