Provides information about the device's camera.

print(global.deviceInfoSystem.getTrackingCamera().principalPoint);

Hierarchy (View Summary, Expand)

Constructors

Properties

focalLength: vec2

Provides the focal length of the device camera in pixels.

pose: mat4

Provides the relative offset between a reference point on the device and the camera. On mobile, the reference point is same as the camera, so this transform is identity.

On Spectacles, the reference point is the device center and the transform converts points in camera space to points relative to device center. Together with pose from DeviceTracking, you can obtain the world positions of points in device camera space.

For example,

// @input SceneObject objectWithDeviceTracking

// Get device camera
const deviceCamera = global.deviceInfoSystem.getTrackingCamera();
// calculate 3d position in device camera space (using your custom code which uses snapml or a similar technique)
const pointInDeviceCamera = ...; // vec3
const pointInDeviceRef = deviceCamera.pose.multiplyPoint(pointInDeviceCamera);

const deviceWorldTransform = script.objectWithDeviceTracking.getTransform().getWorldTransform();
const pointInWorld = deviceWorldTransform.multiplyPoint(pointInDeviceRef);
// Use pointInWorld. For example, place a scene object at this world position
principalPoint: vec2

Provides the principal point of the device camera in pixels with origin at the center of the top-left pixel. Note: Principal point is typically in the center of the image, but it may not always be the case.

resolution: vec2

Provides the default resolution of the image returned by the device camera in pixels. The principal point and focal length are calculated relative to this resolution. If you resize the image to a different resolution than the default, then you also need to update the principal points and focal length appropriately.

Methods

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

  • Given a point in device reference space, first converts the point to 3d camera space, using extrinsics, and then projects it to produce a point in normalized screen space (origin at top left).

    Parameters

    • pointInDeviceReferenceNode: vec3

    Returns vec2

  • Unprojects the normalized screen space point normalizedScreenSpacePoint based on some distance absoluteDepth to produce a 3d position in device reference space. On Spectacles, this means that the returned position already includes the offset between the device center and the camera.

    Parameters

    • normalizedScreenSpacePoint: vec2
    • absoluteDepth: number

    Returns vec3

MMNEPVFCICPMFPCPTTAAATR