interface IARCamera (Niantic.ARDK.AR.IARCamera)

Overview

Interface for platform specific implementations of an ARCamera. Contains information about the camera position and imaging characteristics for a captured video frame in an AR session. More...

interface IARCamera: IDisposable {
    // properties

    Resolution CPUImageResolution;
    CameraIntrinsics CPUIntrinsics;
    Resolution ImageResolution;
    CameraIntrinsics Intrinsics;
    Matrix4x4 ProjectionMatrix;
    TrackingState TrackingState;
    TrackingStateReason TrackingStateReason;
    Matrix4x4 Transform;
    float WorldScale;

    // methods

    Matrix4x4 CalculateProjectionMatrix(
        ScreenOrientation orientation,
        int viewportWidth,
        int viewportHeight,
        float nearClipPlane,
        float farClipPlane
    );

    Matrix4x4 GetViewMatrix(ScreenOrientation orientation);

    Vector2 ProjectPoint(
        Vector3 point,
        ScreenOrientation orientation,
        int viewportWidth,
        int viewportHeight
    );
};

// direct descendants

interface IUpdatableARCamera;

Detailed Documentation

Interface for platform specific implementations of an ARCamera. Contains information about the camera position and imaging characteristics for a captured video frame in an AR session.

Properties

Resolution CPUImageResolution

The resolution of the CPU captured image, in pixels.

CameraIntrinsics CPUIntrinsics

The focal length and principal point of the camera used to generate the CPU image.

Resolution ImageResolution

The width and height of the captured image, in pixels.

CameraIntrinsics Intrinsics

The focal length and principal point of this camera.

Matrix4x4 ProjectionMatrix

A transform matrix appropriate for rendering 3D content to match the image captured by the camera.

This property is equivalent to Camera.CalculateProjectionMatrix called with the captured image's properties and default zNear and zFar of 0.001 and 1000.0, respectively.

TrackingState TrackingState

The general quality of position tracking available when the camera captured a frame.

Use this property to keep your users informed as well as internally for peerState and whether to process the enclosed data or not.

TrackingStateReason TrackingStateReason

A possible diagnosis for limited position tracking quality as of when the camera captured a frame.

注釈

This is an iOS-only value.

Matrix4x4 Transform

The position and orientation of the camera in world coordinate space.

This transform's coordinate space is always constant relative to the device orientation.

float WorldScale

The scaling factor applied to this camera's Transform.

Methods

Matrix4x4 CalculateProjectionMatrix(
    ScreenOrientation orientation,
    int viewportWidth,
    int viewportHeight,
    float nearClipPlane,
    float farClipPlane
)

Returns a transform matrix appropriate for rendering 3D content to match the image captured by the camera, using the specified parameters.

注釈

Returns a pre-calculated value in Remote Debugging.

Parameters:

orientation

The current orientation of the interface.

viewportWidth

Viewport width, in pixels.

viewportHeight

Viewport height, in pixels.

nearClipPlane

Near clip plane, in meters.

farClipPlane

Far clip plane, in meters.

Matrix4x4 GetViewMatrix(ScreenOrientation orientation)

Returns a transform matrix for converting from world space to camera space. This matrix is in a left-handed coordinate system with the camera's forward direction along the positive Z-axis. This is unlike Unity's camera worldToCameraMatrix, which uses a OpenGL-style, right-handed coordinate system with the camera's forward direction along the negative Z-axis. Convert from this coordinate system to the Unity/OpenGL system by negating the Z-axis, for example:

var UnityViewMatrix = ARDKViewMatrix;
UnityViewMatrix.m20 *= -1.0f;
UnityViewMatrix.m21 *= -1.0f;
UnityViewMatrix.m22 *= -1.0f;
UnityViewMatrix.m23 *= -1.0f;

注釈

Returns a pre-calculated value in Remote Debugging.

Parameters:

orientation

The current orientation of the interface.

Vector2 ProjectPoint(
    Vector3 point,
    ScreenOrientation orientation,
    int viewportWidth,
    int viewportHeight
)

Returns the projection of a point from the 3D world space detected by the session into the 2D space of a view rendering the scene.

注釈

This is an iOS-only method.

注釈

Not currently supported in Remote Debugging.

Parameters:

point

A point in 3D world space.

orientation

The current orientation of the interface.

viewportWidth

Viewport width, in pixels.

viewportHeight

Viewport height, in pixels.