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.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
center.x |
- |
|
center.y |
- |
|
center.z |
- |
|
collision |
0 ≤ x ≤ 15, integer |
|
height |
0. |
|
radius |
0. |
|
slopeLimit |
0 ≤ x ≤ 90 |
|
speed |
0 ≤ x ≤ 1000 |
|
turnSpeed |
0 ≤ x ≤ 36000 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
CharacterController::state-changeCharacterController::arrive
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A chaser that runs at the playerA character with a Character Controller and no player controls runs towards the main camera every frame with move, and stops two metres short.
Drag to orbit the camera around the yard: the chaser turns and runs after you, and stops when it is close. Scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(CharacterControllerComponent); if (component) log(component.props);}