If true user input interrupts the camera from animating to a target
true
When enabled the scene will be automatically fitted into the camera view in onEnable
false
When enabled the camera will rotate automatically
false
The speed at which the camera will rotate automatically. Will only be used when autoRotate
is enabled
1.0
When enabled OrbitControls will automatically raycast find a look at target in start
true
When enabled the camera will fit the scene to the camera view when the background is clicked the specified number of times within a short time
2
The damping factor for the camera movement. For more information see the three.js documentation
0.1
If true the camera will focus on the target when the left mouse button is double clicked
true
When enabled the camera movement will be damped
true
When enabled the camera can be moved using keyboard keys. The keys are defined in the controls.keys
property
true
When enabled the camera can be panned
true
When enabled the camera can be rotated
true
When enabled the camera can be zoomed
true
the object this component is attached to. Note that this is a threejs Object3D with some additional features
the unique identifier for this component
Assigning a LookAtConstraint will make the camera look at the constraint source
null
The weight of the first lookAtConstraint source
1
The maximum azimuth angle in radians
The maximum polar angle in radians
Math.PI
The maximum zoom level
Infinity
If true the camera will focus on the target when the middle mouse button is clicked
The minimum azimuth angle in radians
The minimum polar angle in radians
0
The minimum zoom level
0
Optional
sourceholds the source identifier this object was created with/from (e.g. if it was part of a glTF file the sourceId holds the url to the glTF)
The duration in seconds it takes for the camera look ad and position lerp to reach their destination (when set via setCameraTargetPosition
and setLookTargetPosition
)
1
Sets the zoom speed of the OrbitControls
1
Set to true to enable zooming to the cursor position.
false
true if the object is enabled and active in the hierarchy
True while the camera position is being lerped
The object being controlled by the OrbitControls (usually the camera)
See https://threejs.org/docs/#examples/en/controls/OrbitControls.object
{@type Object3D | null}
The underlying three.js OrbitControls.
See https://threejs.org/docs/#examples/en/controls/OrbitControls
{@type ThreeOrbitControls | null}
true if this component was destroyed (this.destroy()
) or the whole object this component was part of
the layer of the gameObject this component is attached to
True while the camera look target is being lerped
the name of the gameObject this component is attached to
shorthand for this.context.scene
the scene of the context
Is the gameObject marked as static
the tag of the gameObject this component is attached to
use targetLerpDuration
insteadThe speed at which the camera target and the camera will be lerping to their destinations (if set via script or user input)
Optional
init: Partial<NoInternalNeedleEngineState<FilterStartingWith<FilterTypes<OrbitControls, Function>, "_">>>Optional
earlyOptional
lateuse controls.target.lerp(position, delta)
Optional
onOptional
onOptional
onOptional
onOptional
onOptional
onCallback when this component joins a xr session (or becomes active in a running XR session)
Optional
onCallback when this component exists a xr session (or when it becomes inactive in a running XR session)
Optional
onOptional
onOptional
onOptional
onOptional
onOptional
onOptional
onRegister callback when user starts interacting with the orbit controls
Optional
onOptional
onOptional
onOptional
onCallback when a xr session updates (while it is still active in XR session)
Optional
onOptional
onXRControllerCallback when a controller is connected/added while in a XR session
OR when the component joins a running XR session that has already connected controllers
OR when the component becomes active during a running XR session that has already connected controllers
Optional
onXRControllerOptional
resolveSets camera target position and look direction. Does perform a raycast in the forward direction of the passed in object to find an orbit point
Moves the camera to position smoothly.
Optional
position: Object3D<Object3DEventMap> | Vector3LikeThe position in local space of the controllerObject to move the camera to. If null the camera will stop lerping to the target.
If true the camera will move immediately to the new position, otherwise it will lerp. If a number is passed in it will be used as the duration of the lerp.
Moves the camera look-at target to a position smoothly.
The position in world space to move the camera target to. If null the camera will stop lerping to the target.
If true the camera target will move immediately to the new position, otherwise it will lerp. If a number is passed in it will be used as the duration of the lerp.
starts a coroutine (javascript generator function)yield
will wait for the next frame:
yield WaitForSeconds(1)
to wait for 1 second.yield WaitForFrames(10)
to wait for 10 frames.yield new Promise(...)
to wait for a promise to resolve.generator function to start
event to register the coroutine for (default: FrameEvent.Update). Note that all coroutine FrameEvent callbacks are invoked after the matching regular component callbacks. For example FrameEvent.Update
will be called after regular component update()
methods)
the generator function (use it to stop the coroutine with stopCoroutine
)
onEnable() { this.startCoroutine(this.myCoroutine()); }
private *myCoroutine() {
while(this.activeAndEnabled) {
console.log("Hello World", this.context.time.frame);
// wait for 5 frames
for(let i = 0; i < 5; i++) yield;
}
}
Stop a coroutine that was previously started with startCoroutine
the routine to be stopped
the frame event to unregister the routine from (default: FrameEvent.Update)
Optional
supportsXROptional callback, you can implement this to only get callbacks for VR or AR sessions if necessary.
true if the mode is supported (if false the mode is not supported by this component and it will not receive XR callbacks for this mode)
Optional
updateGenerated using TypeDoc
The OrbitControls component is used to control a camera using the OrbitControls from three.js library.
The three OrbitControls object can be accessed via the
controls
property.The object being controlled by the OrbitControls (usually the camera) can be accessed via the
controllerObject
property.