Skip to main content

Class: ColliderManager

Creates and updates colliders and collider event callbacks.

Constructors

Constructor

new ColliderManager(): ColliderManager;

Returns

ColliderManager

Methods

CreateBox()

static CreateBox(entity): Promise<number>;

Creates a box collider on an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<number>

A promise that resolves to the created Collider.


CreateSphere()

static CreateSphere(entity): Promise<number>;

Creates a sphere collider on an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<number>

A promise that resolves to the created Collider.


CreateCapsule()

static CreateCapsule(entity): Promise<number>;

Creates a capsule collider on an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<number>

A promise that resolves to the created Collider.


Destroy()

static Destroy(entity, collider): Promise<boolean>;

Destroys a collider on an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
collidernumberThe Collider to destroy.

Returns

Promise<boolean>

A promise that resolves to true if the collider was destroyed, or false otherwise.


HasComponent()

static HasComponent(entity, collider): Promise<boolean>;

Checks whether an entity has a collider.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.
collidernumberThe Collider to check.

Returns

Promise<boolean>

A promise that resolves to true if the entity has the collider, or false otherwise.


GetEntity()

static GetEntity(collider): Promise<number>;

Gets the entity that owns a collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<number>

A promise that resolves to the owning Entity.


GetAllColliders()

static GetAllColliders(entity): Promise<number[]>;

Gets all colliders on an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<number[]>

A promise that resolves to the list of Collider handles.


GetBoxColliderCenter()

static GetBoxColliderCenter(collider): Promise<vec3>;

Gets the center of a box collider.

An error is thrown if the collider is not a box collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<vec3>

A promise that resolves to the box collider center.


SetBoxColliderCenter()

static SetBoxColliderCenter(collider, center): Promise<void>;

Sets the center of a box collider.

An error is thrown if the collider is not a box collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
centervec3The box collider center.

Returns

Promise<void>

A promise that resolves when the center has been changed.


GetBoxColliderSize()

static GetBoxColliderSize(collider): Promise<vec3>;

Gets the size of a box collider.

An error is thrown if the collider is not a box collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<vec3>

A promise that resolves to the box collider size.


SetBoxColliderSize()

static SetBoxColliderSize(collider, size): Promise<void>;

Sets the size of a box collider.

An error is thrown if the collider is not a box collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
sizevec3The box collider size.

Returns

Promise<void>

A promise that resolves when the size has been changed.


GetSphereColliderCenter()

static GetSphereColliderCenter(collider): Promise<vec3>;

Gets the center of a sphere collider.

An error is thrown if the collider is not a sphere collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<vec3>

A promise that resolves to the sphere collider center.


SetSphereColliderCenter()

static SetSphereColliderCenter(collider, center): Promise<void>;

Sets the center of a sphere collider.

An error is thrown if the collider is not a sphere collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
centervec3The sphere collider center.

Returns

Promise<void>

A promise that resolves when the center has been changed.


GetSphereColliderRadius()

static GetSphereColliderRadius(collider): Promise<number>;

Gets the radius of a sphere collider.

An error is thrown if the collider is not a sphere collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<number>

A promise that resolves to the sphere collider radius.


SetSphereColliderRadius()

static SetSphereColliderRadius(collider, radius): Promise<void>;

Sets the radius of a sphere collider.

An error is thrown if the collider is not a sphere collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
radiusnumberThe sphere collider radius.

Returns

Promise<void>

A promise that resolves when the radius has been changed.


GetCapsuleColliderCenter()

static GetCapsuleColliderCenter(collider): Promise<vec3>;

Gets the center of a capsule collider.

An error is thrown if the collider is not a capsule collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<vec3>

A promise that resolves to the capsule collider center.


SetCapsuleColliderCenter()

static SetCapsuleColliderCenter(collider, center): Promise<void>;

Sets the center of a capsule collider.

An error is thrown if the collider is not a capsule collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
centervec3The capsule collider center.

Returns

Promise<void>

A promise that resolves when the center has been changed.


GetCapsuleColliderRadius()

static GetCapsuleColliderRadius(collider): Promise<number>;

Gets the radius of a capsule collider.

An error is thrown if the collider is not a capsule collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<number>

A promise that resolves to the capsule collider radius.


SetCapsuleColliderRadius()

static SetCapsuleColliderRadius(collider, radius): Promise<void>;

Sets the radius of a capsule collider.

An error is thrown if the collider is not a capsule collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
radiusnumberThe capsule collider radius.

Returns

Promise<void>

A promise that resolves when the radius has been changed.


GetCapsuleColliderHeight()

static GetCapsuleColliderHeight(collider): Promise<number>;

Gets the height of a capsule collider.

An error is thrown if the collider is not a capsule collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<number>

A promise that resolves to the capsule collider height.


SetCapsuleColliderHeight()

static SetCapsuleColliderHeight(collider, height): Promise<void>;

Sets the height of a capsule collider.

An error is thrown if the collider is not a capsule collider.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
heightnumberThe capsule collider height.

Returns

Promise<void>

A promise that resolves when the height has been changed.


GetIsTrigger()

static GetIsTrigger(collider): Promise<boolean>;

Gets whether a collider is a trigger.

Parameters

ParameterTypeDescription
collidernumberThe Collider to inspect.

Returns

Promise<boolean>

A promise that resolves to true if the collider is a trigger, or false otherwise.


SetIsTrigger()

static SetIsTrigger(collider, isTrigger): Promise<void>;

Sets whether a collider is a trigger.

Parameters

ParameterTypeDescription
collidernumberThe Collider to update.
isTriggerbooleanWhether the collider is a trigger.

Returns

Promise<void>

A promise that resolves when the trigger setting has been changed.


OnTriggerEnter()

static OnTriggerEnter(entity, onTriggerEnter): Promise<boolean>;

Registers a callback for trigger enter events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onTriggerEnter(entity, collider) => voidThe callback invoked when another collider enters the trigger.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnTriggerExit()

static OnTriggerExit(entity, onTriggerExit): Promise<boolean>;

Registers a callback for trigger exit events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onTriggerExit(entity, collider) => voidThe callback invoked when another collider exits the trigger.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnTriggerStay()

static OnTriggerStay(entity, onTriggerStay): Promise<boolean>;

Registers a callback for trigger stay events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onTriggerStay(entity, collider) => voidThe callback invoked while another collider remains in the trigger.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnCollisionEnter()

static OnCollisionEnter(entity, onCollisionEnter): Promise<boolean>;

Registers a callback for collision enter events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onCollisionEnter(entity, collider) => voidThe callback invoked when another collider begins colliding.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnCollisionExit()

static OnCollisionExit(entity, onCollisionExit): Promise<boolean>;

Registers a callback for collision exit events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onCollisionExit(entity, collider) => voidThe callback invoked when another collider stops colliding.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnCollisionStay()

static OnCollisionStay(entity, onCollisionStay): Promise<boolean>;

Registers a callback for collision stay events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onCollisionStay(entity, collider) => voidThe callback invoked while another collider remains in contact.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnUserTriggerEnter()

static OnUserTriggerEnter(entity, onUserTriggerEnter): Promise<boolean>;

Registers a callback for user trigger enter events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onUserTriggerEnter(user) => voidThe callback invoked when a user enters the trigger.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnUserTriggerExit()

static OnUserTriggerExit(entity, onUserTriggerExit): Promise<boolean>;

Registers a callback for user trigger exit events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onUserTriggerExit(user) => voidThe callback invoked when a user exits the trigger.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.


OnUserTriggerStay()

static OnUserTriggerStay(entity, onUserTriggerStay): Promise<boolean>;

Registers a callback for user trigger stay events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onUserTriggerStay(user) => voidThe callback invoked while a user remains in the trigger.

Returns

Promise<boolean>

A promise that resolves to true if the callback was registered, or false otherwise.