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 High Fidelity 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. |
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. |
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. |
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. |
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. Onlyworks 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. |
stopLookingAt
|
None |
Stops the camera from continually looking at the position that was set with Camera.keepLookingAt. |
Signals
Name | Summary |
---|---|
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 thefollowing 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
ExampleUse a PickRay to detect mouse clicks on entities.
|
(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) 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) keepLookingAt( position ) | ||||||
---|---|---|---|---|---|---|
Sets the camera to continue looking at the specified Parameters
|
(static) lookAt( position ) | ||||||
---|---|---|---|---|---|---|
Rotates the camera to look at the specified Parameters
ExampleRotate your camera to look at entities as you click on them with your mouse.
|
(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
ExampleMove your camera to the position and orientation of the closest entity.
|
(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. Onlyworks 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) stopLookingAt( ) |
---|
Stops the camera from continually looking at the position that was set with Camera.keepLookingAt. |
Signal Details
modeUpdated(
newMode
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when the camera mode changes. Parameters
ExampleReport camera mode changes.
|