Orbit Controller
Updated
Drag to orbit, wheel to zoom around a point or entity.
- Type
comp-orbit-controller- Script class
OrbitControllerComponent- 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 |
|---|---|---|
distance |
0 ≤ x ≤ 10000 |
|
distanceRange |
0 ≤ x ≤ 10000 |
|
moveSpeed |
0 ≤ x ≤ 50 |
|
pitchLimit |
0 ≤ x ≤ 89 |
|
rotateSpeed |
0 ≤ x ≤ 1 |
|
smoothTime |
0 ≤ x ≤ 0.5 |
|
target |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Keep an orbit camera out of the wallsAn orbit camera circles a statue inside a walled yard. Its Camera Collision sweeps from the statue to the camera, so when you orbit behind a wall the camera is pulled in front of it, and eases back out once clear.
Drag to orbit until a wall comes between you and the statue: the camera slides in front of the wall instead of behind it. The log reports how far it was pulled in.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(OrbitControllerComponent); if (component) log(component.props);}