Description
Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts
TheCamera
API provides access to the "camera" that defines your view in desktop and HMD display modes.
The Vircadia camera has axes x
= right, y
= up, -z
= forward.Properties
Name | Type | Summary |
---|---|---|
position | Vec3 |
The position of the camera. You can set this value only when the camera is in independent mode. |
orientation | Quat |
The orientation of the camera. You can set this value only when the camera is in independent mode. |
mode | Camera.Mode |
The camera mode. |
frustum | ViewFrustum |
The camera frustum. |
cameraEntity | Uuid |
The ID of the entity that is used for the camera position and orientation when the camera is in entity mode. |
captureMouse | boolean |
The mouse capture state. When |
sensitivity | number |
The current camera sensitivity. Must be positive. |
Methods
Name | Return Value | Summary |
---|---|---|
computePickRay
|
PickRay |
Computes a PickRay based on the current camera configuration and the specified |
getCameraEntity
|
Uuid |
Gets the ID of the entity that the camera is set to follow (i.e., use the position and orientation from) when it's in entity mode. You can also get the entity ID using the Camera.cameraEntity property. |
getCaptureMouse
|
boolean |
Gets the current mouse capture state. |
getModeString
|
Camera.Mode |
Gets the current camera mode. You can also get the mode using the Camera.mode property. |
getOrientation
|
Quat |
Gets the current camera orientation. You can also get the orientation using the Camera.orientation property. |
getPosition
|
Vec3 |
Gets the current camera position. You can also get the position using the Camera.position property. |
getSensitivity
|
number |
Gets the current camera sensitivity. |
keepLookingAt
|
None |
Sets the camera to continue looking at the specified |
lookAt
|
None |
Rotates the camera to look at the specified |
setCameraEntity
|
None |
Sets the entity that the camera should follow (i.e., use the position and orientation from) when it's in entity mode. You can also set the entity using the Camera.cameraEntity property. |
setCaptureMouse
|
None |
Sets the mouse capture state. When |
setModeString
|
None |
Sets the camera mode. You can also set the mode using the Camera.mode property. |
setOrientation
|
None |
Sets the camera orientation. You can also set the orientation using the Camera.orientation property. Only works if the camera is in independent mode. |
setPosition
|
None |
Sets the camera position. You can also set the position using the Camera.position property. Only works if the camera is in independent mode. |
setSensitivity
|
None |
Sets the camera sensitivity. Higher values mean that the camera will be more sensitive to mouse movements. |
stopLookingAt
|
None |
Stops the camera from continually looking at the position that was set with Camera.keepLookingAt. |
Signals
Name | Summary |
---|---|
captureMouseChanged
|
Triggered when the camera mouse capture state changes. |
modeUpdated
|
Triggered when the camera mode changes. |
Type Definitions
Mode Type: string |
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Camera modes affect the position of the camera and the controls for camera movement. The camera can be in one of the following modes:
|
Method Details
(static) computePickRay( x, y ) → {PickRay}
Returns: The computed PickRay. |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Computes a PickRay based on the current camera configuration and the specified Parameters
Example
|
(static) getCameraEntity( ) → {Uuid}
Returns: The ID of the entity that the camera is set to follow when in entity mode; null if no
camera entity has been set.
|
---|
Gets the ID of the entity that the camera is set to follow (i.e., use the position and orientation from) when it's in entity mode. You can also get the entity ID using the Camera.cameraEntity property. |
(static) getCaptureMouse( ) → {boolean}
Returns: true if the mouse is captured (is invisible and cannot leave the bounds of Interface,
if Interface is the active window and no menu item is selected), false if the mouse is behaving normally.
|
---|
Gets the current mouse capture state. |
(static) getModeString( ) → {Camera.Mode}
Returns: The current camera mode. |
---|
Gets the current camera mode. You can also get the mode using the Camera.mode property. |
(static) getOrientation( ) → {Quat}
Returns: The current camera orientation. |
---|
Gets the current camera orientation. You can also get the orientation using the Camera.orientation property. |
(static) getPosition( ) → {Vec3}
Returns: The current camera position. |
---|
Gets the current camera position. You can also get the position using the Camera.position property. |
(static) getSensitivity( ) → {number}
Returns: The current camera sensitivity. Must be positive. |
---|
Gets the current camera sensitivity. |
(static) keepLookingAt( position ) | ||||||
---|---|---|---|---|---|---|
Sets the camera to continue looking at the specified Parameters
|
(static) lookAt( position ) | ||||||
---|---|---|---|---|---|---|
Rotates the camera to look at the specified Parameters
Example
|
(static) setCameraEntity( entityID ) | ||||||
---|---|---|---|---|---|---|
Sets the entity that the camera should follow (i.e., use the position and orientation from) when it's in entity mode. You can also set the entity using the Camera.cameraEntity property. Parameters
Example
|
(static) setCaptureMouse( captureMouse ) | ||||||
---|---|---|---|---|---|---|
Sets the mouse capture state. When Parameters
|
(static) setModeString( mode ) | ||||||
---|---|---|---|---|---|---|
Sets the camera mode. You can also set the mode using the Camera.mode property. Parameters
|
(static) setOrientation( orientation ) | ||||||
---|---|---|---|---|---|---|
Sets the camera orientation. You can also set the orientation using the Camera.orientation property. Only works if the camera is in independent mode. Parameters
|
(static) setPosition( position ) | ||||||
---|---|---|---|---|---|---|
Sets the camera position. You can also set the position using the Camera.position property. Only works if the camera is in independent mode. Parameters
|
(static) setSensitivity( sensitivity ) | ||||||
---|---|---|---|---|---|---|
Sets the camera sensitivity. Higher values mean that the camera will be more sensitive to mouse movements. Parameters
|
(static) stopLookingAt( ) |
---|
Stops the camera from continually looking at the position that was set with Camera.keepLookingAt. |
Signal Details
captureMouseChanged(
newCaptureMouse
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the camera mouse capture state changes. Parameters
Example
|
modeUpdated(
newMode
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the camera mode changes. Parameters
Example
|