DeviceMapper Component
The DeviceMapper component in the Haply Inverse Unity plugin is designed to manage the discovery, opening and mapping of Haply devices, such as the Inverse3 and VerseGrip, with the scene's GameObjects and Device Controllers. It provides a unified interface for interacting with these devices, allowing for dynamic control and configuration based on runtime conditions.
Overview
The primary function of the DeviceMapper is to facilitate communication between the software and the connected Haply hardware.
It ensures that devices are properly initialized and mapped, and it maintains the state of each device, enabling responsive and interactive experiences in Unity applications.
Devices information poll
To balance performance and real-time data accuracy, the DeviceMapper uses a polling mechanism to update certain device information, such as power supply status and body orientation. The polling behavior is controlled by the following modes:
-
Polling Modes:
- Manual: In this mode, device information is updated only when explicitly requested by the user or developer. This mode is performance-friendly and suitable for scenarios where real-time updates are not critical.
- Once: This mode triggers a single update of device information immediately after the device is opened. It provides a snapshot of the device state at initialization, which is useful for setting initial conditions.
- Continuous: In this mode, the component continuously updates device information at intervals specified by the
devicesInfoPollDelay
setting. While this mode ensures the most up-to-date information, it is recommended to use it only during setup or debugging phases.
-
Poll Delay: The
devicesInfoPollDelay
setting, applicable in Continuous mode, defines the interval in seconds between automatic updates of device information. The minimum allowed delay is 0.5 seconds, with a recommended minimum of 1 second to minimize the risk of haptic jitters. Developers should carefully manage this setting, balancing the need for timely data with the potential performance impact.
Continuous polling can cause haptic jitters due to frequent updates, which can interfere with the performance and responsiveness of haptic feedback systems.
Ready Event
The DeviceMapper
component triggers a Ready
event when all connected devices are opened and mapped.
This event signals that it is safe to start using device getters methods, such as GetInverse3
or GetVerseGrip
, to retrieve scene's device controllers for further interaction.
Device List
In the Unity Editor, the DeviceMapper
provides a dynamic list of connected devices, displayed in the Inspector during play mode.
This list includes details such as device type, ID, and connection status, aiding developers in monitoring and managing devices and facilitating troubleshooting during development.