Protected
constructorReadonly
focalProvides the focal length of the device camera in pixels.
Readonly
poseProvides 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
Readonly
principalProvides 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.
Readonly
resolutionProvides 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.
Returns the name of this object's type.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other
. Useful for checking if two references point to the same thing.
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.
Provides information about the device's camera.
Example