Class TrackedPoseDriver
The TrackedPoseDriver component applies the current pose value of a tracked device to the Transform of the GameObject. TrackedPoseDriver can track multiple types of devices including XR HMDs, controllers, and remotes.
Inherited Members
Namespace: UnityEngine.InputSystem.XR
Syntax
[Serializable]
[AddComponentMenu("XR/Tracked Pose Driver (Input System)")]
public class TrackedPoseDriver : MonoBehaviour, ISerializationCallbackReceiver
Remarks
For positionInput and rotationInput, if an action is directly defined in the InputActionProperty, as opposed to a reference to an action externally defined in an InputActionAsset, the action will automatically be enabled and disabled by this behavior during OnEnable() and OnDisable(). The enabled state for actions externally defined must be managed externally from this behavior.
Properties
ignoreTrackingState
Ignore tracking state and always treat the input pose as valid when updating the Transform properties. The recommended value is false so the tracking state input is used.
Declaration
public bool ignoreTrackingState { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
positionAction
(Deprecated) The action to read the position value of a tracked device. Must support reading a value of type Vector3.
Declaration
public InputAction positionAction { get; set; }
Property Value
Type | Description |
---|---|
InputAction |
See Also
positionInput
The input action to read the position value of a tracked device. Must support reading a value of type Vector3.
Declaration
public InputActionProperty positionInput { get; set; }
Property Value
Type | Description |
---|---|
InputActionProperty |
See Also
rotationAction
(Deprecated) The action to read the rotation value of a tracked device. Must support reading a value of type Quaternion.
Declaration
public InputAction rotationAction { get; set; }
Property Value
Type | Description |
---|---|
InputAction |
See Also
rotationInput
The input action to read the rotation value of a tracked device. Must support reading a value of type Quaternion.
Declaration
public InputActionProperty rotationInput { get; set; }
Property Value
Type | Description |
---|---|
InputActionProperty |
See Also
trackingStateInput
The input action to read the tracking state value of a tracked device. Identifies if position and rotation have valid data. Must support reading a value of type Int32.
Declaration
public InputActionProperty trackingStateInput { get; set; }
Property Value
Type | Description |
---|---|
InputActionProperty |
Remarks
See InputTrackingState enum for values the input action represents.
- InputTrackingState.None (0)to indicate neither position nor rotation is valid.
- InputTrackingState.Position (1)to indicate position is valid.
- InputTrackingState.Rotation (2)to indicate rotation is valid.
- InputTrackingState.Position
|
InputTrackingState.Rotation (3)to indicate position and rotation is valid.
See Also
trackingType
The tracking type being used by the Tracked Pose Driver to control which Transform properties to update.
Declaration
public TrackedPoseDriver.TrackingType trackingType { get; set; }
Property Value
Type | Description |
---|---|
TrackedPoseDriver.TrackingType |
See Also
updateType
The update type being used by the Tracked Pose Driver to control which phases of the player loop will update Transform properties.
Declaration
public TrackedPoseDriver.UpdateType updateType { get; set; }
Property Value
Type | Description |
---|---|
TrackedPoseDriver.UpdateType |
See Also
Methods
Awake()
This function is called when the script instance is being loaded.
Declaration
protected virtual void Awake()
OnBeforeRender()
This method is called after the Input System has completed an update and processed all pending events when the type of update is BeforeRender.
Declaration
protected virtual void OnBeforeRender()
OnDestroy()
This function is called when the MonoBehaviour will be destroyed.
Declaration
protected virtual void OnDestroy()
OnDisable()
This function is called when the object becomes disabled or inactive.
Declaration
protected void OnDisable()
OnEnable()
This function is called when the object becomes enabled and active.
Declaration
protected void OnEnable()
OnUpdate()
This method is called after the Input System has completed an update and processed all pending events when the type of update is not BeforeRender.
Declaration
protected virtual void OnUpdate()
PerformUpdate()
Updates Transform properties with the current input pose values that have been read, constrained by tracking type and tracking state.
Declaration
protected virtual void PerformUpdate()
See Also
Reset()
This function is called when the user hits the Reset button in the Inspector's context menu or when adding the component the first time. This function is only called in editor mode.
Declaration
protected void Reset()
SetLocalTransform(Vector3, Quaternion)
Updates Transform properties, constrained by tracking type and tracking state.
Declaration
protected virtual void SetLocalTransform(Vector3 newPosition, Quaternion newRotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | newPosition | The new local position to possibly set. |
Quaternion | newRotation | The new local rotation to possibly set. |
UpdateCallback()
The callback method called after the Input System has completed an update and processed all pending events.
Declaration
protected void UpdateCallback()
See Also
Explicit Interface Implementations
ISerializationCallbackReceiver.OnAfterDeserialize()
Declaration
void ISerializationCallbackReceiver.OnAfterDeserialize()
Implements
ISerializationCallbackReceiver.OnBeforeSerialize()
Declaration
void ISerializationCallbackReceiver.OnBeforeSerialize()