Skip to content

Fly Controller

Updated

Free-fly camera: look with the mouse, move with WASD and E/Q.

Type
comp-fly-controller
Script class
FlyControllerComponent
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
lookSpeed 0 ≤ x ≤ 1
moveSpeed 0 ≤ x ≤ 50
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(FlyControllerComponent);
if (component) log(component.props);
}