Skip to main content
Version: 2.1.1

Haply::Inverse::Unity::VerseGrip

Represents a VerseGrip device, handling its state and interactions.

Inherits from Haply.Inverse.Unity.DeviceBehaviour, MonoBehaviour

Public Events

Name
DeviceDelegateDeviceStateChanged()
Event triggered when the state of the VerseGrip device changes.

Public Functions

Name
delegate voidDeviceDelegate(VerseGrip verseGrip)
Delegate for handling VerseGrip state changes.
boolGetButton(VerseGripButton button =VerseGripButton.Button0)
Returns true while the user holds down the button.
boolGetButtonDown(VerseGripButton button =VerseGripButton.Button0)
Returns true during the frame when the user starts pressing the specified button.
boolGetButtonUp(VerseGripButton button =VerseGripButton.Button0)
Returns true during the frame when the user starts releasing the specified button.

Public Properties

Name
override DeviceTypeDeviceType
override CursorBehaviourCursor
QuaternionLocalRotation
QuaternionOrientation
VerseGrip orientation.
boolIsAttached
Indicates whether the VerseGrip is attached to the Inverse3.

Protected Properties

Name
override BaseCoordinateConverterCoordinateConverter

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.

Additional inherited members

Public Events inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
Action< DeviceBehaviour, Ret >ErrorEvent()
ConnectionStateDelegateConnectionStateChanged()
Event triggered when the device connection state changes.
Action< DeviceBehaviour, DeviceConnectionState, DeviceConnectionState >ConnectionStateChangedAsync()
Event triggered shortly after the device connection state changes.

Public Functions inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
delegate voidConnectionStateDelegate(DeviceBehaviour device, DeviceConnectionState state, DeviceConnectionState prevState)
Delegate for handling connection state changes of the device.
voidSetSetupToPerform()
Indicate to perform setup on next frame.
override stringToString()
Returns a string representation of the object, providing a human-readable description that includes the object's name, class type, and device ID.

Protected Functions inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
virtual voidSetup()
This method is automatically called once the _performSetup flag is set to handle consuming calculations too heavy to be called on each frame.
virtual voidAwake()
voidOnEnable()
voidOnDisable()
voidOnDestroy()
virtual voidFixedUpdate()

Public Properties inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
intSelectedDeviceId
uintDeviceId
Gets the device ID.
DeviceConnectionStateConnectionState
Gets or sets the current connection state of the device.
boolIsConnected
Gets whether the device is connected.
boolIsOpened
Gets whether the device is opened.
boolIsReady

Protected Properties inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
boolIsCursorSet
Indicates whether the Cursor has been set.

Public Attributes inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
const intANY_ID
UnityEvent< DeviceBehaviour >DeviceOpened
Event triggered when the ConnectionState transitions to the DeviceConnectionState.Opened state.
UnityEvent< DeviceBehaviour >DeviceClosed
Event triggered when the ConnectionState transitions to the DeviceConnectionState.Connected state.

Protected Attributes inherited from Haply.Inverse.Unity.DeviceBehaviour

Name
string_objectName

Public Events Documentation

event DeviceStateChanged

DeviceDelegate DeviceStateChanged()

Event triggered when the state of the VerseGrip device changes.

See: ClientConfiguration.HapticPollFrequency

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.HapticPollFrequency.

Public Functions Documentation

function DeviceDelegate

delegate void DeviceDelegate(
VerseGrip verseGrip
)

Delegate for handling VerseGrip state changes.

Parameters:

  • verseGrip 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.

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;

property Orientation

Quaternion Orientation;

VerseGrip orientation.

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.

Protected Property Documentation

property CoordinateConverter

override BaseCoordinateConverter CoordinateConverter;

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.