Skip to main content
←API Reference ←com.nianticspatial.nsdk.playback ←PlaybackCamera

getProjectionMatrix


Declaration​

fun getProjectionMatrix( zNear: Float, zFar: Float, viewportWidth: Int, viewportHeight: Int, deviceDisplayOrientation: Orientation? = null ): FloatArray

Summary​

OpenGL-style projection matrix (column-major) from intrinsics for the given viewport and near/far.
Use with getViewMatrix to render 3D content aligned with the playback camera.


The frustum is cropped to the viewport's aspect ratio the same way
com.nianticspatial.nsdk.utils.ImageMath.displayTransform crops the camera image, so 3D content
lines up with the displayed image. Passing the image resolution as the viewport gives the
uncropped projection.

Parameters​

NameTypeSummary
zNearFloat
Near plane distance
zFarFloat
Far plane distance (use 0 for infinite far)
viewportWidthInt
Viewport width in pixels
viewportHeightInt
Viewport height in pixels
deviceDisplayOrientationOrientation?
Device orientation in Android UI convention (ROTATION_90 → LANDSCAPE_LEFT); defaults to [orientation] when null