ColliderComponent

ColliderComponent

Adds a physics collider to the entity. If the entity or any of its ancestors have a {RigidBodyComponent}, the collider is added to the physics world.

Constructor

new ColliderComponent(settingsopt)

Parameters:
Name Type Attributes Description
settings Object <optional>
Properties
Name Type Attributes Default Description
collider Collider <optional>
isTrigger boolean <optional>
false

Members

(static) numCylinderSegments

Deprecated:
  • Yes

cannonBody :CANNON.Body

The Cannon.js Body instance, if the ColliderComponent was initialized without a RigidBodyComponent.

cannonShape :CANNON.Body

The Cannon.js Shape instance

Methods

(static) getCannonShape(collider) → {CANNON.Shape}

Create a CANNON.Shape given a Collider. A BoxCollider yields a CANNON.Box and so on.

Parameters:
Name Type Description
collider Collider
Deprecated:
  • Yes

destroy()

Remove the collider from the physics world. Does the opposite of .initialize()

initialize()

Initialize the collider as a static rigid body in the physics world.

syncTransform()

Sync the transform of cannonBody in the physical engine to be the same as the entity in our engine