Skip to content

First Person Controller

Updated

Mouse-look from the player’s eyes.

Type
comp-first-person-controller
Script class
FirstPersonControllerComponent
Per entity
One
Version
2.0.0

Read about it in Camera controllers: 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
lookHeight -20 ≤ x ≤ 20
lookSpeed 0 ≤ x ≤ 1
pitch -89 ≤ x ≤ 89
pitchLimit 0 ≤ x ≤ 89
smoothTime 0 ≤ x ≤ 0.5

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(FirstPersonControllerComponent);
if (component) log(component.props);
}