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.
Properties
Section titled “Properties”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 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Fly freely with the Fly controllerA Fly controller lets the camera move anywhere, ignoring gravity: WASD to fly, drag to look. The script switches between a gentle and a fast speed when you press F.
Click the view, then fly with WASD and drag to look around the ring of pillars; press F to switch between slow and fast flight.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(FlyControllerComponent); if (component) log(component.props);}