API reference

PassthroughCameraAccess Class

Extends MonoBehaviour
Provides access to the Passthrough Camera Access API.

This component requires the "horizonos.permission.HEADSET_CAMERA" permission to be present in AndroidManifest.xml: <uses-permission android:name="horizonos.permission.HEADSET_CAMERA" /> See documentation: https://developers.meta.com/horizon/documentation/unity/unity-pca-overview/

Fields

CameraPosition : CameraPositionType
Requested camera position. To access both left and right camera simultaneously, create two instances of PassthroughCameraAccess with different PassthroughCameraAccess.CameraPosition
Signature
CameraPositionType CameraPosition
RequestedResolution : Vector2Int
The requested resolution of the camera. If the requested resolution is not present in GetSupportedResolutions, the first smaller resolution will be selected instead.
Signature
Vector2Int RequestedResolution
TargetMaterial : Material
Signature
Material TargetMaterial

Properties

CurrentResolution : Vector2Int
[Get]
The current resolution of camera. May be different from the RequestedResolution.
Signature
Vector2Int CurrentResolution
Intrinsics : CameraIntrinsics
[Get]
The static intrinsic parameters of the sensor. These parameters become available after the PassthroughCameraAccess is enabled and never change after that.
Signature
CameraIntrinsics Intrinsics
IsPlaying : bool
[Get]
Indicates whether the component is enabled and has received the camera image at least once.
Signature
bool IsPlaying
IsSupported : bool
[Get]
Returns true if the current headset supports Passthrough Camera Access.
Signature
bool IsSupported
IsUpdatedThisFrame : bool
[Get]
Returns 'true' if the camera texture was updated this frame.
Signature
bool IsUpdatedThisFrame
TexturePropertyName : string
[Get][Set]
The name of the texture property to update.
If changed at runtime, we recache the shader property ID so that Material.SetTexture(...) uses the new name.
Signature
string TexturePropertyName
Timestamp : DateTime
[Get]
Timestamp associated with the current camera image.
Signature
DateTime Timestamp

Methods

GetCameraPose ()
Signature
Pose GetCameraPose()
Returns
Pose
GetColors ()
Retrieves color data of the latest camera image.
Use this method to process camera images on CPU.
Do not cache, modify or dispose the contents of the returned native array.
Signature
NativeArray< Color32 > GetColors()
Returns
NativeArray< Color32 >  Native array that contains all pixels of the captured image.
GetTexture ()
Retrieves GPU texture of the latest camera image.
Use this method to access camera images on GPU.
Signature
Texture GetTexture()
Returns
Texture  Texture with the latest camera image.
ViewportPointToRay ( viewportPoint )
Returns a world-space ray going from camera through a viewport point.
Signature
Ray ViewportPointToRay(Vector2 viewportPoint)
Parameters
viewportPoint: Vector2  Viewport-space is normalized and relative to the camera. The bottom-left of the camera is (0,0); the top-right is (1,1).
Returns
Ray  World-space ray.
WorldToViewportPoint ( worldPosition )
Transforms worldPosition from world-space into viewport-space.
Signature
Vector2 WorldToViewportPoint(Vector3 worldPosition)
Parameters
worldPosition: Vector3  A world-space position.
Returns
Vector2  Viewport-space coordinate. Viewport-space is normalized and relative to the camera. The bottom-left of the camera is (0,0); the top-right is (1,1).

Static Methods

GetSupportedResolutions ( cameraPosition )
Retrieves supported resolutions of the given camera.
Signature
static unsafe Vector2Int[] GetSupportedResolutions(CameraPositionType cameraPosition)
Parameters
cameraPosition: CameraPositionType  The position of the camera (Left or Right).
Returns
unsafe Vector2Int[]  An array containing all supported resolutions.

Inner Struct

CameraIntrinsics Struct

The static intrinsic parameters of the sensor.

Fields

FocalLength : Vector2
The focal length of the camera.
Signature
Vector2 FocalLength
LensOffset : Pose
The translation and orientation of the camera sensor relative to the headset.
Signature
Pose LensOffset
PrincipalPoint : Vector2
The principal point of the camera.
Signature
Vector2 PrincipalPoint
SensorResolution : Vector2Int
The sensor resolution of the camera.
Signature
Vector2Int SensorResolution

Inner Enum

CameraPositionType Enum

Possible positions of the camera (Left or Right).

Enumeration Constants

Member
Left
Right