If true user input interrupts the camera from animating to a target
When enabled the scene will be automatically fitted into the camera view in onEnable
When enabled the camera will rotate automatically
The speed at which the camera will rotate automatically. Will only be used when autoRotate
is enabled
When enabled OrbitControls will automatically raycast find a look at target in start
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
The damping factor for the camera movement. For more information see the three.js documentation
If true the camera will focus on the target when the left mouse button is double clicked
When enabled the camera movement will be damped
When enabled the camera can be moved using keyboard keys. The keys are defined in the controls.keys
property
When enabled the camera can be panned
When enabled the camera can be rotated
When enabled the camera can be zoomed
Reference to the GameObject this component is attached to This is a three.js Object3D with additional GameObject functionality
Unique identifier for this component instance, used for finding and tracking components
Assigning a LookAtConstraint will make the camera look at the constraint source
The weight of the first lookAtConstraint source
The maximum azimuth angle in radians
The maximum polar angle in radians
The maximum zoom level
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
The minimum zoom level
Optional
sourceIdentifier for the source asset that created this component. For example, URL to the glTF file this component was loaded from
The duration in seconds it takes for the camera look ad and position lerp to reach their destination (when set via setCameraTargetPosition
and setLookTargetPosition
)
Sets the zoom speed of the OrbitControls
Set to true to enable zooming to the cursor position.
Checks if this component is currently active (enabled and part of an active GameObject hierarchy) Components that are inactive won't receive lifecycle method calls
True if the component is enabled and all parent GameObjects are active
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}
Checks if this component has been destroyed
True if the component or its GameObject has been destroyed
Controls whether this component is enabled Disabled components don't receive lifecycle callbacks
Gets the forward direction vector (0,0,-1) of this component's GameObject in world space
The layer value of the GameObject this component is attached to Used for visibility and physics filtering
True while the camera look target is being lerped
The name of the GameObject this component is attached to Used for debugging and finding objects
Gets the right direction vector (1,0,0) of this component's GameObject in world space
Shorthand accessor for the current scene from the context
The scene this component belongs to
Indicates whether the GameObject is marked as static Static objects typically don't move and can be optimized by the engine
The tag of the GameObject this component is attached to Used for categorizing objects and efficient lookup
Gets the up direction vector (0,1,0) of this component's GameObject in world space
Gets the rotation of this component's GameObject in world space as a quaternion
Note: This is equivalent to calling this.gameObject.worldQuaternion
Sets the rotation of this component's GameObject in world space using a quaternion
The world rotation quaternion to set
Gets the rotation of this component's GameObject in world space as Euler angles (in degrees)
Note: This is equivalent to calling this.gameObject.worldRotation
Sets the rotation of this component's GameObject in world space using Euler angles (in degrees)
The world rotation vector to set (in degrees)
Destroys this component and removes it from its GameObject After destruction, the component will no longer receive lifecycle callbacks
Dispatches an event to all registered listeners
The event object to dispatch
Always returns false (standard implementation of EventTarget)
Optional
earlyCalled at the beginning of each frame before regular updates. Use for logic that needs to run before standard update callbacks.
Optional
lateCalled after all update functions have been called. Use for calculations that depend on other components being updated first.
Optional
onCalled after the scene has been rendered. Use for post-processing or UI updates that should happen after rendering
Optional
onCalled before an XR session is requested Use to modify session initialization parameters
The XR session mode being requested
The session initialization parameters that can be modified
Optional
onCalled when this component's collider begins colliding with another collider.
Information about the collision that occurred
Optional
onCalled when this component's collider stops colliding with another collider.
Information about the collision that ended
Optional
onCalled each frame while this component's collider is colliding with another collider
Information about the ongoing collision
Optional
onCalled when this component joins an XR session or becomes active in a running session
Event data for the XR session
Optional
onCalled when this component exits an XR session or becomes inactive during a session
Event data for the XR session
Optional
onCalled when the context's pause state changes.
Whether the context is currently paused
The previous pause state
Optional
onCalled when a pointer completes a click interaction with this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer button is pressed while over this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer enters this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer exits this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer moves while over this component's GameObject
Data about the pointer event
Optional
onCalled when a pointer button is released while over this component's GameObject
Data about the pointer event
Register callback when user starts interacting with the orbit controls
Optional
onCalled when this component's trigger collider is entered by another collider
The collider that entered this trigger
Optional
onCalled when another collider exits this component's trigger collider
The collider that exited this trigger
Optional
onCalled each frame while another collider is inside this component's trigger collider
The collider that is inside this trigger
Optional
onCalled each frame while this component is active in an XR session
Event data for the current XR frame
Optional
onCalled when a field decorated with @validate() is modified.
Optional
prop: stringThe name of the field that was changed
Optional
onXRControllerCalled when an XR controller is connected or when this component becomes active in a session with existing controllers
Event data for the controller that was added
Optional
onXRControllerCalled when an XR controller is disconnected or when this component becomes inactive during a session with controllers
Event data for the controller that was removed
Optional
resolveCalled when this component needs to remap guids after an instantiate operation.
Mapping from old guids to newly generated guids
Sets camera target position and look direction using a raycast in forward direction of the object.
The object to raycast from. If a camera is passed in the camera position will be used as the source.
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.
This is useful for example if you want to align your camera with an object in your scene (or another camera). Simply pass in this other camera object
true if the target was set successfully
Moves the camera to position smoothly.
Optional
position: null | 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.
Sets the position of this component's GameObject in world space using individual coordinates
X-coordinate in world space
Y-coordinate in world space
Z-coordinate in world space
Sets the rotation of this component's GameObject in world space using quaternion components
X component of the quaternion
Y component of the quaternion
Z component of the quaternion
W component of the quaternion
Sets the rotation of this component's GameObject in world space using individual Euler angles
X-axis rotation
Y-axis rotation
Z-axis rotation
Whether the values are in degrees (true) or radians (false)
Starts a coroutine that can yield to wait for events. Coroutines allow for time-based sequencing of operations without blocking. Coroutines are based on generator functions, a JavaScript language feature.
Generator function to start
Event to register the coroutine for (default: FrameEvent.Update)
The generator function that can be used to stop the coroutine
Call to stop camera position lerping
Stops a coroutine that was previously started with startCoroutine
The routine to be stopped
The frame event the routine was registered with
Call to stop camera look target lerping
Optional
supportsXRDetermines if this component supports a specific XR mode
The XR session mode to check support for
True if the component supports the specified mode
Optional
updateCalled once per frame during the main update loop. The primary location for frame-based game logic.
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.