API reference
API reference
Select your platform
No SDKs available
No versions available

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/

Member Enumerations

Enumeration CameraPositionType

Possible positions of the camera (Left or Right).
Left
No description available
Right
No description available

Fields

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

Properties

Maximum framerate for the camera stream (frames per second).
The actual framerate may vary based on lighting conditions and the current workload. This property can only be changed when the component is disabled.
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.
Indicates whether the component is enabled and has received the camera image at least once.
Timestamp associated with the latest camera image.
The current resolution of the camera. May be different from the RequestedResolution.
The static intrinsic parameters of the sensor. These parameters become available after the PassthroughCameraAccess is enabled and never change after that.
Returns 'true' if the camera texture was updated this frame.
Returns true if the current headset supports Passthrough Camera Access.

Member Functions

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.
NOTE: this method is expensive, consider using a non-blocking version of AsyncGPUReadback instead.
Returns
Native array that contains all pixels of the captured image.
Retrieves GPU texture of the latest camera image.
Use this method to access camera images on GPU.
The texture is updated in render thread before the frame is displayed. This means that performing blocking operations such as Graphics.Blit() will pick the texture from the previous frame. To access the latest texture on CPU, use AsyncGPUReadback instead.
Returns
Texture with the latest camera image.
Returns a world-space ray going from camera through a viewport point.
Parameters
viewportPoint
Viewport-space is normalized and relative to the camera. The bottom-left of the camera is (0,0); the top-right is (1,1).
cameraPose
Optional camera pose that should be used for calculation. For example, you can cache GetCameraPose, do a long-running image processing, then use the cached camera pose with this method.
Returns
World-space ray.
Transforms worldPosition from world-space into viewport-space.
Parameters
worldPosition
A world-space position.
cameraPose
Optional camera pose that should be used for calculation. For example, you can cache GetCameraPose, do a long-running image processing, then use the cached camera pose with this method.
Returns
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).
Returns
Camera's world-space pose at Timestamp.

Static Member Functions

Retrieves supported resolutions of the given camera.
Parameters
cameraPosition
The position of the camera (Left or Right).
Returns
An array containing all supported resolutions.
Did you find this page helpful?