Class: FCollider
A 2d collider that can be attached to a component.
Accessors
component
get
component():undefined
|FComponent
set
component(component
):void
Parameters
• component: undefined
| FComponent
Returns
undefined
| FComponent
Defined in
Constructors
new FCollider()
new FCollider(
scene
,options
?):FCollider
Creates a collider for a given component.
Parameters
• scene: FScene
The scene the collider belongs to.
• options?: FColliderOptions
The options for the collider.
Returns
Example
const collider = new FCollider(scene, {
position: { x: 0, y: 0 },
scale: { x: 1, y: 1 },
shape: FShapes.CIRCLE
})
Defined in
Methods
__SET_POSITION__()
__SET_POSITION__(
position
):void
Set the position of the collider.
Parameters
• position: FVector2
The new position of the collider.
Returns
void
Defined in
__SET_ROTATION__()
__SET_ROTATION__(
rotation
):void
Set the rotation of the collider.
Parameters
• rotation: number
The new rotation of the collider in degrees.
Returns
void
Defined in
__SET_SCALE__()
__SET_SCALE__(
scale
):void
Set the scale of the collider.
Parameters
• scale: FVector2
The new scale of the collider.
Returns
void
Defined in
__UPDATE_POSITION__()
__UPDATE_POSITION__(
initiator
):void
Update the position of the collider according to the transform. This method should be called after updating the transform properties.
Parameters
• initiator: boolean
= false
By default (false), the collider won't be considered as the initiator of the position update. This means the new position will be the position of the attached component, plus the offset. Setting this to true will propagate the event to other objects (component, sensor,...).
Returns
void
Defined in
__UPDATE_ROTATION__()
__UPDATE_ROTATION__(
initiator
):void
Update the rotation of the collider according to the transform. This method should be called after updating the transform properties.
Parameters
• initiator: boolean
= false
By default (false), the collider won't be considered as the initiator of the rotation update. This means the new rotation will be the rotation of the attached component, plus the offset. Setting this to true will propagate the event to other objects (component, sensor,...).
Returns
void
Defined in
__UPDATE_SCALE__()
__UPDATE_SCALE__(
initiator
):void
Update the scale of the collider according to the transform. This method should be called after updating the transform properties.
Parameters
• initiator: boolean
= false
By default (false), the collider won't be considered as the initiator of the scale update. This means the new scale will be the scale of the attached component, plus the offset. Setting this to true will propagate the event to other objects (component, sensor,...).
Returns
void
Defined in
frame()
frame(
_delta
):void
Parameters
• _delta: number
Returns
void
Defined in
Properties
__COLLIDER__
__COLLIDER__:
Collider
RAPIER Collider
Defined in
__COMPONENT__?
optional
__COMPONENT__:FComponent
The component the collider is attached to.
Defined in
offset
offset:
FTransform
The transform offset of the collider.
Defined in
shape
shape:
FShapes
The shape of the collider.
Defined in
transform
transform:
FTransform
The transform of the collider.