Skip to main content
API Reference NSDK

PlaybackCamera

Camera representation built from frame metadata (pose4x4, intrinsics, resolution). Exposes the same...

Declaration

final class PlaybackCamera

Summary

Camera representation built from frame metadata (pose4x4, intrinsics, resolution). Exposes the same concepts as ARCamera: transform, viewMatrix, projectionMatrix, viewportRect, displayOrientedTransform. Relation to Apple AR: Stands in for ARCamera during playback. No Apple camera; we synthesize view/projection from recorded intrinsics and pose. Use PlaybackFrame.camera to obtain an instance.


Properties

NameTypeSummary
var eulerAnglessimd_float3
Euler angles (pitch, yaw, roll) in radians, extracted from the transform; order matches ARKit.
var exposureDurationTimeInterval
Exposure duration in seconds. Playback has no exposure data; returns a default.
var exposureOffsetFloat
Exposure offset in EV. Playback has no exposure data; returns 0.
var imageResolutionCGSize
The camera's image resolution in pixels.
var intrinsicssimd_float3x3
The camera's intrinsic matrix (fx, fy, cx, cy layout).
var projectionMatrixsimd_float4x4
Default projection matrix (infinite far plane). Uses metadata.projection when available; otherwise built from intrinsics using orientation from metadata (screenOrientation), or inferred from image resolution (portrait if height > width, else landscape-right), or landscape-right as last resort.
For display-time orientation or custom near/far, use projectionMatrix(for:viewportSize:zNear:zFar:).
var recordedOrientationUIInterfaceOrientation
The interface orientation the frame was recorded in. Uses metadata screenOrientation when set; else inferred from image resolution (height > width → portrait, else landscape-right); else landscape-right.
var trackingStateARCamera.TrackingState
Camera tracking state (from metadata.tracking).
var transformsimd_float4x4
The 4×4 camera-to-world transformation matrix from the frame metadata (pose4x4).

Methods

NameTypeSummary
displayOrientedTransformsimd_float4x4
Returns the camera transform with a Z-axis rotation applied so it matches the given screen orientation.
Sensor frame is landscape-right; portrait adds π/2, portrait-upside-down adds -π/2, landscape-left adds π.
projectionMatrixsimd_float4x4
Returns a projection matrix for the given orientation and viewport, with the requested near/far planes.
Built from intrinsics with orientation applied: portrait swaps fx/fy and dimensions; landscape-left flips principal point.
projectPointCGPoint
Projects a 3D world-space point into 2D viewport pixel coordinates (origin top-left).
Returns (-1, -1) if the point is behind the camera. Uses intrinsics and view for the given orientation.
viewMatrixsimd_float4x4
Returns the view matrix (world-to-camera) for the given interface orientation.
Implemented as the inverse of the display-oriented transform so rendering matches the on-screen camera.
viewportRectCGRect
Viewport rect that covers the drawable via aspect-fill, matching how NSDKView renders the camera background.
ARKit sensor images are always in landscape orientation.
- Parameters:
- drawableSize: The drawable size (e.g. MTKView drawable size).
- displayOrientation: The current device interface orientation. When provided, the content aspect is computed for that orientation so the viewport fits the drawable when the device is in portrait or landscape. When nil, uses the frame's recorded orientation (backward compatibility).