Skip to main content

Class XRCameraConfigurationProvider

Attaches the Varjo XR camera origin to the ego vehicle's head-pivot Transform at runtime, so that the headset's 6-DoF tracking is expressed relative to the driver's head position inside the simulated car.

public sealed class XRCameraConfigurationProvider : BaseCameraConfigurationProvider

Inheritance​

Remarks​

The XROrigin cannot be embedded inside the car prefab because the XR subsystem fails to initialise correctly when the origin starts as part of a prefab hierarchy at the current version. It therefore lives as a standalone scene object, and this provider reparents it to XRPivot at runtime in Camera) once the camera has spawned, so vehicle motion from PrometeoCarController is correctly inherited by the headset tracking space without the XR origin needing to be part of the prefab.

Camera) guards against the standard (non-XR) camera that Unity may set as Camera.main on WebGL builds, where the XR subsystem is absent.

Methods​

IsCameraCompatible(Camera)​

Determines if the given camera is compatible with the camera configuration.

protected override bool IsCameraCompatible(Camera camera)

Parameters​

NameTypeDescription
cameraCameraThe camera to check for compatibility.

Returns​

bool — Returns true if the camera is compatible.

Remarks​

A camera is compatible if it is part of a hierarchy that includes an XROrigin.

OnCameraSet(Camera)​

Callback when a compatible camera is assigned to this pawn. Use this to set up neccessary references or targets to the camera controller.

protected override void OnCameraSet(Camera camera)

Parameters​

NameTypeDescription
cameraCameraThe camera that has been assigned as the main camera to this pawn.