Camera

public class Camera

Represents a virtual camera, which determines the perspective through which the scene is viewed.

If the camera is part of an ArSceneView, then the camera automatically tracks the camera pose from ARCore. Additionally, the following methods will throw UnsupportedOperationException when called:

All other functionality in Node is supported. You can access the position and rotation of the camera, assign a collision shape to the camera, or add children to the camera. Disabling the camera turns off rendering.

Public Methods

float
float
Matrix
Matrix
Ray
screenPointToRay(float x, float y)
Calculates a ray in world space going from the near-plane of the camera and going through a point in screen space.
void
setLocalPosition(Vector3 position)
Set the position of the camera.
void
setLocalRotation(Quaternion rotation)
Set the rotation of the camera.
void
setParent(NodeParent parent)
Unsupported operation.
void
setWorldPosition(Vector3 position)
Set the position of the camera.
void
setWorldRotation(Quaternion rotation)
Set the rotation of the camera.
Vector3
worldToScreenPoint(Vector3 point)
Convert a point from world space into screen space.

Inherited Methods

Public Methods

public float getFarClipPlane ()

public float getNearClipPlane ()

public Matrix getProjectionMatrix ()

public Matrix getViewMatrix ()

public Ray screenPointToRay (float x, float y)

Calculates a ray in world space going from the near-plane of the camera and going through a point in screen space. Screen space is in Android device screen coordinates: TopLeft = (0, 0) BottomRight = (Screen Width, Screen Height) The device coordinate space is unaffected by the orientation of the device.

Parameters
x X position in device screen coordinates.
y Y position in device screen coordinates.

public void setLocalPosition (Vector3 position)

Set the position of the camera. The camera always isTopLevel(), therefore this behaves the same as setWorldPosition(Vector3).

If the camera is part of an ArSceneView, then this is an unsupported operation. Camera's position cannot be changed, it is controlled by the ARCore camera pose.

Parameters
position The position to apply.

public void setLocalRotation (Quaternion rotation)

Set the rotation of the camera. The camera always isTopLevel(), therefore this behaves the same as setWorldRotation(Quaternion).

If the camera is part of an ArSceneView, then this is an unsupported operation. Camera's rotation cannot be changed, it is controlled by the ARCore camera pose.

Parameters
rotation The rotation to apply.

public void setParent (NodeParent parent)

Unsupported operation. Camera's parent cannot be changed, it is always the scene.

Parameters
parent The new parent that this node will be a child of. If null, this node will be detached from its parent.

public void setWorldPosition (Vector3 position)

Set the position of the camera. The camera always isTopLevel(), therefore this behaves the same as setLocalPosition(Vector3).

If the camera is part of an ArSceneView, then this is an unsupported operation. Camera's position cannot be changed, it is controlled by the ARCore camera pose.

Parameters
position The position to apply.

public void setWorldRotation (Quaternion rotation)

Set the rotation of the camera. The camera always isTopLevel(), therefore this behaves the same as setLocalRotation(Quaternion).

If the camera is part of an ArSceneView, then this is an unsupported operation. Camera's rotation cannot be changed, it is controlled by the ARCore camera pose.

Parameters
rotation The rotation to apply.

public Vector3 worldToScreenPoint (Vector3 point)

Convert a point from world space into screen space. X will be between zero and the width of the SceneView. Y will be between zero and the height of the SceneView. Z will always be zero.

Parameters
point the point in world space to convert
Returns
  • a new vector that represents the point in screen-space.

Send feedback about...