Haply::Inverse::Unity::VerseGrip
Represents a VerseGrip device, handling its state and interactions.
Inherits from DeviceBehaviour
Public Events
Name | |
---|---|
DeviceDelegate | DeviceStateChanged() Event triggered when the state of the VerseGrip device changes. |
Public Functions
Name | |
---|---|
delegate void | DeviceDelegate(VerseGrip device) Delegate for handling VerseGrip state changes. |
bool | GetButton(VerseGripButton button =VerseGripButton.Button0) Returns true while the user holds down the button. |
bool | GetButtonDown(VerseGripButton button =VerseGripButton.Button0) Returns true during the frame when the user starts pressing the specified button. |
bool | GetButtonUp(VerseGripButton button =VerseGripButton.Button0) Returns true during the frame when the user starts releasing the specified button. |
Protected Functions
Name | |
---|---|
override void | AddClientListeners(Internal.ClientConnection clientConnection) |
override void | RemoveClientListeners(Internal.ClientConnection clientConnection) |
Public Properties
Name | |
---|---|
override DeviceType | DeviceType |
override CursorBehaviour | Cursor |
Quaternion | LocalRotation VerseGrip orientation relative to the parent transform. |
bool | IsAttached Indicates whether the VerseGrip is attached to the Inverse3. |
int | ButtonCount |
Public Attributes
Name | |
---|---|
UnityEvent< VerseGrip > | Attached Event triggered when the VerseGrip is attached to a device. |
UnityEvent< VerseGrip > | Detached Event triggered when the VerseGrip is detached from a device. |
UnityEvent< VerseGrip, VerseGripButton > | ButtonDown Event triggered when a VerseGrip button is pressed down. |
UnityEvent< VerseGrip, VerseGripButton > | ButtonUp Event triggered when a VerseGrip button is released. |
Public Events Documentation
event DeviceStateChanged
DeviceDelegate DeviceStateChanged()
Event triggered when the state of the VerseGrip device changes.
See: ClientConfiguration.HapticFrequencyHz
This event is useful for responding to changes in the device's orientation or button presses in real-time. During this event, you can use properties such as LocalRotation, GetButton or IsAttached.
The frequency at which this event is triggered is determined by the haptic loop frequency, which can be configured via ClientConfiguration.HapticFrequencyHz.
Public Functions Documentation
function DeviceDelegate
delegate void DeviceDelegate(
VerseGrip device
)
Delegate for handling VerseGrip state changes.
Parameters:
- device The VerseGrip device that triggered the event.
function GetButton
bool GetButton(
VerseGripButton button =VerseGripButton.Button0
)
Returns true while the user holds down the button.
Parameters:
- button The button to check.
Return: True if the button is pressed, false otherwise.
function GetButtonDown
bool GetButtonDown(
VerseGripButton button =VerseGripButton.Button0
)
Returns true during the frame when the user starts pressing the specified button.
Parameters:
- button The button to check.
See: ButtonDown, ButtonUp, DeviceStateChanged, GetButton, GetButtonUp
Return: True if the button is pressed this frame, false otherwise.
This method should be called within the DeviceStateChanged event callback to function correctly. Calling it from the main thread may miss the frame when the button state changes. For main thread usage, it is preferable to use the ButtonDown event.
function GetButtonUp
bool GetButtonUp(
VerseGripButton button =VerseGripButton.Button0
)
Returns true during the frame when the user starts releasing the specified button.
Parameters:
- button The button to check.
See: ButtonDown, ButtonUp, DeviceStateChanged, GetButton, GetButtonDown
Return: True if the button was released this frame, false otherwise.
This method should be called within the DeviceStateChanged event callback to function correctly. Calling it from the main thread may miss the frame when the button state changes. For main thread usage, it is preferable to use the ButtonUp event.
Protected Functions Documentation
function AddClientListeners
override void AddClientListeners(
Internal.ClientConnection clientConnection
)
function RemoveClientListeners
override void RemoveClientListeners(
Internal.ClientConnection clientConnection
)
Public Property Documentation
property DeviceType
override DeviceType DeviceType;
property Cursor
override CursorBehaviour Cursor;
This property overrides the base DeviceBehaviour.Cursor property and can be safely cast to VerseGripCursor. Setting this property also updates the DeviceBehaviour._performSetup flag.
property LocalRotation
Quaternion LocalRotation;
VerseGrip orientation relative to the parent transform.
The device DeviceBehaviour.ConnectionState must be DeviceConnectionState.Opened first to get a consistent value.
property IsAttached
bool IsAttached;
Indicates whether the VerseGrip is attached to the Inverse3.
property ButtonCount
static int ButtonCount;
Public Attributes Documentation
variable Attached
UnityEvent< VerseGrip > Attached;
Event triggered when the VerseGrip is attached to a device.
This event is dispatched on the main thread, allowing for safe interactions with Unity scene objects and UI elements. Note that the device state is updated on a separate high-frequency thread, so the state at the time of the event might differ slightly from the current state when handling the event.
variable Detached
UnityEvent< VerseGrip > Detached;
Event triggered when the VerseGrip is detached from a device.
This event is dispatched on the main thread, allowing for safe interactions with Unity scene objects and UI elements. Note that the device state is updated on a separate high-frequency thread, so the state at the time of the event might differ slightly from the current state when handling the event.
variable ButtonDown
UnityEvent< VerseGrip, VerseGripButton > ButtonDown;
Event triggered when a VerseGrip button is pressed down.
This event is dispatched on the main thread, allowing for safe interactions with Unity scene objects and UI elements. Note that the device state is updated on a separate high-frequency thread, so the state at the time of the event might differ slightly from the current state when handling the event.
variable ButtonUp
UnityEvent< VerseGrip, VerseGripButton > ButtonUp;
Event triggered when a VerseGrip button is released.
This event is dispatched on the main thread, allowing for safe interactions with Unity scene objects and UI elements. Note that the device state is updated on a separate high-frequency thread, so the state at the time of the event might differ slightly from the current state when handling the event.