Class TouchController
- Namespace
- Stride.VirtualReality
- Assembly
- Stride.VirtualReality.dll
A VR hand controller. It is an input device: an owner such as a VR menu can capture it, and while it is captured its buttons, touches and axes report no input to scripts and systems. Its pose and haptics are not affected.
public abstract class TouchController : IInputDevice, IDisposable
- Inheritance
-
objectTouchController
- Implements
- Extension Methods
Remarks
Backends provide the controller's input through the protected raw members. The public queries apply the controller's CaptureState to them.
Constructors
TouchController()
protected TouchController()
Properties
AngularVelocity
public abstract Vector3 AngularVelocity { get; }
Property Value
CaptureState
The capture state of this device. Only InputManager changes it.
public DeviceCaptureState CaptureState { get; }
Property Value
Remarks
Return the same instance on every call, for example from { get; } = new DeviceCaptureState();.
Grip
Gets the grip value, from 0 to 1. It reads 0 while the controller is captured.
public float Grip { get; }
Property Value
HapticsSupport
Degree to which this touch controller type supports haptics. None: no haptics support, controller does not vibrate. Limited: cannot vibrate at any specific frequency or amplitude. Corresponding parameter is ignored. Full: vibrate method respects both frequency and vibration parameters
public abstract TouchController.ControllerHaptics HapticsSupport { get; }
Property Value
Id
The unique identifier of this device
public Guid Id { get; }
Property Value
IndexPointing
Gets whether the index finger points, off the trigger. It reads false while the controller is captured.
public bool IndexPointing { get; }
Property Value
IndexResting
Gets whether the index finger rests on the trigger. It reads false while the controller is captured.
public bool IndexResting { get; }
Property Value
LinearVelocity
public abstract Vector3 LinearVelocity { get; }
Property Value
Name
The name of the device
public virtual string Name { get; }
Property Value
Position
public abstract Vector3 Position { get; }
Property Value
Priority
The device priority. Larger means higher priority when selecting the first device of some type
public int Priority { get; set; }
Property Value
RawGrip
Gets the grip value reported by the backend, whether or not the controller is captured.
protected abstract float RawGrip { get; }
Property Value
RawIndexPointing
Gets whether the backend reports the index finger pointing, whether or not the controller is captured.
protected abstract bool RawIndexPointing { get; }
Property Value
RawIndexResting
Gets whether the backend reports the index finger resting on the trigger, whether or not the controller is captured.
protected abstract bool RawIndexResting { get; }
Property Value
RawThumbAxis
Gets the thumb position on the touchpad or the thumbstick reported by the backend, whether or not the controller is captured.
protected abstract Vector2 RawThumbAxis { get; }
Property Value
RawThumbResting
Gets whether the backend reports the thumb resting on the thumb controls, whether or not the controller is captured.
protected abstract bool RawThumbResting { get; }
Property Value
RawThumbUp
Gets whether the backend reports the thumb up, whether or not the controller is captured.
protected abstract bool RawThumbUp { get; }
Property Value
RawThumbstickAxis
Gets the thumbstick position reported by the backend, whether or not the controller is captured.
protected abstract Vector2 RawThumbstickAxis { get; }
Property Value
RawTrigger
Gets the trigger value reported by the backend, whether or not the controller is captured.
protected abstract float RawTrigger { get; }
Property Value
Rotation
public abstract Quaternion Rotation { get; }
Property Value
Source
Gets the input source the controller is registered with, or null before the VR system registers it.
public IInputSource Source { get; }
Property Value
State
public abstract DeviceState State { get; }
Property Value
ThumbAxis
Gets the thumb position on the touchpad or the thumbstick, depending on the backend. It reads zero while the controller is captured.
public Vector2 ThumbAxis { get; }
Property Value
ThumbResting
Gets whether the thumb rests on the thumb controls. It reads false while the controller is captured.
public bool ThumbResting { get; }
Property Value
ThumbUp
Gets whether the thumb is up, off the thumb controls. It reads false while the controller is captured.
public bool ThumbUp { get; }
Property Value
ThumbstickAxis
Gets the thumbstick position. It reads zero while the controller is captured.
public Vector2 ThumbstickAxis { get; }
Property Value
Trigger
Gets the trigger value, from 0 to 1. It reads 0 while the controller is captured.
public float Trigger { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public virtual void Dispose()
IsPressReleased(TouchControllerButton)
Returns true if in this frame the button was released
public bool IsPressReleased(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsPressed(TouchControllerButton)
Returns true if button is in the pressed state
public bool IsPressed(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsPressedDown(TouchControllerButton)
Returns true if in this frame the button switched to pressed state
public bool IsPressedDown(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsRawPressReleased(TouchControllerButton)
Returns true if the backend reports that the button was released this frame.
protected abstract bool IsRawPressReleased(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsRawPressed(TouchControllerButton)
Returns true if the backend reports the button in the pressed state.
protected abstract bool IsRawPressed(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsRawPressedDown(TouchControllerButton)
Returns true if the backend reports that the button switched to the pressed state this frame.
protected abstract bool IsRawPressedDown(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsRawTouchReleased(TouchControllerButton)
Returns true if the backend reports that the button stopped being touched this frame.
protected abstract bool IsRawTouchReleased(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsRawTouched(TouchControllerButton)
Returns true if the backend reports the button in the touched state.
protected abstract bool IsRawTouched(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsRawTouchedDown(TouchControllerButton)
Returns true if the backend reports that the button switched to the touched state this frame.
protected abstract bool IsRawTouchedDown(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsTouchReleased(TouchControllerButton)
Returns true if in this frame the button stopped being touched
public bool IsTouchReleased(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsTouched(TouchControllerButton)
Returns true if button is in the touched state
public bool IsTouched(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
IsTouchedDown(TouchControllerButton)
Returns true if in this frame the button switched to touched state
public bool IsTouchedDown(TouchControllerButton button)
Parameters
buttonTouchControllerButton
Returns
Update(GameTime)
public virtual void Update(GameTime time)
Parameters
timeGameTime
Vibrate(int, float, float)
Vibrate the controller for a fixed duration. Do so at specified frequency/amplitude if supported by runtime. Oculus runtime supports vibrating at frequency 0.0, 0.5, or 1.0, and amplitude in range [0.0, 1.0] openVR supports vibrating, but does not support frequency or amplitude openXR and WindowsMixedReality currently do not support vibration.
public abstract Task Vibrate(int durationMs, float frequency = 1, float amplitude = 1)
Parameters
durationMsintVibration duration, in milliseconds
frequencyfloatFrequency of vibration in range [0.0, 1.0]
amplitudefloatAmplitude of vibration in range [0.0, 1.0]