Skip to content

Character Controller

Updated

The character: a capsule that walks, runs, jumps and falls, from player controls, AI or scripts.

Type
comp-character-controller
Script class
CharacterControllerComponent
Per entity
One
Version
1.0.0

Read about it in Physics layers: what it does, how to use it from a script, and examples.

The props the runtime declares for this component, with their defaults and accepted ranges.

Prop Default Range
center.x -10000 ≤ x ≤ 10000
center.y -10000 ≤ x ≤ 10000
center.z -10000 ≤ x ≤ 10000
collisionLayer 0 ≤ x ≤ 15, integer
height 0.022 ≤ x ≤ 1000
radius 0.001 ≤ x ≤ 100
slopeLimit 0 ≤ x ≤ 90
speed 0 ≤ x ≤ 1000
turnSpeed 0 ≤ x ≤ 36000

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • CharacterController::state-change
  • CharacterController::arrive

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(CharacterControllerComponent);
if (component) log(component.props);
}