Class SnapTurnProvider
Locomotion provider that allows the user to rotate their rig in fixed angle increments based on read input values, such as from the controller thumbstick.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion.Turning
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/Locomotion/Snap Turn Provider", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Turning.SnapTurnProvider.html")]
public class SnapTurnProvider : LocomotionProvider
Properties
canStartMoving
Whether the provider has finished preparing for locomotion and is ready to enter the Moving state. This only applies when locomotionState is Preparing, so there is no need for this implementation to query locomotionState.
Declaration
public override bool canStartMoving { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
See Also
debounceTime
The amount of time that Unity waits before starting another snap turn.
Declaration
public float debounceTime { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
delayTime
The time (in seconds) to delay the first turn after receiving initial input for the turn. Subsequent turns while holding down input are delayed by the debounceTime, not the delay time. This delay can be used, for example, as time to set a tunneling vignette effect as a VR comfort option.
Declaration
public float delayTime { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
enableTurnAround
Controls whether to enable 180° snap turns.
Declaration
public bool enableTurnAround { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
enableTurnLeftRight
Controls whether to enable left and right snap turns.
Declaration
public bool enableTurnLeftRight { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
leftHandTurnInput
Reads input data from the left hand controller. Input Action must be a Value action type (Vector 2).
Declaration
public XRInputValueReader<Vector2> leftHandTurnInput { get; set; }
Property Value
Type | Description |
---|---|
XRInputValueReader<Vector2> |
See Also
rightHandTurnInput
Reads input data from the right hand controller. Input Action must be a Value action type (Vector 2).
Declaration
public XRInputValueReader<Vector2> rightHandTurnInput { get; set; }
Property Value
Type | Description |
---|---|
XRInputValueReader<Vector2> |
See Also
transformation
The transformation that is used by this component to apply turn movement.
Declaration
public XRBodyYawRotation transformation { get; set; }
Property Value
Type | Description |
---|---|
XRBodyYawRotation |
See Also
turnAmount
The number of degrees clockwise Unity rotates the rig when snap turning clockwise.
Declaration
public float turnAmount { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
Methods
GetTurnAmount(Vector2)
Determines the turn amount in degrees for the given input
vector.
Declaration
protected virtual float GetTurnAmount(Vector2 input)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | input | Input vector, such as from a thumbstick. |
Returns
Type | Description |
---|---|
float | Returns the turn amount in degrees for the given |
See Also
OnDisable()
See MonoBehaviour.
Declaration
protected void OnDisable()
See Also
OnEnable()
See MonoBehaviour.
Declaration
protected void OnEnable()
See Also
StartTurn(float)
Begins turning locomotion.
Declaration
protected void StartTurn(float amount)
Parameters
Type | Name | Description |
---|---|---|
float | amount | Amount to turn. |
See Also
Update()
See MonoBehaviour.
Declaration
protected void Update()