Inverse3 and VerseGrip Cursors
The Haply Inverse Unity Package introduces specialized cursor components for the Inverse3 and VerseGrip devices, enabling precise control and interaction within Unity environments. These components, Inverse3 Cursor and VerseGrip Cursor, are designed to dynamically adjust the position and rotation of game objects based on the data from their corresponding Device Controllers.
Overview
Cursor components act as a bridge between the physical Haply devices and virtual game objects in Unity, translating the devices' positional and rotational data into game object movements and orientations. This translation allows users to interact with the virtual environment in an intuitive manner, mirroring their physical movements with virtual responses.
CursorBehaviour Base Class
At the core of the cursor components is the CursorBehaviour
class, which provides the foundational functionality shared by both Inverse3Cursor
and VerseGripCursor
.
This includes managing the device association, model instantiation, and visibility control.
Key Properties and Methods
- Device: Links the cursor to its controlling device, automatically set at runtime.
- ModelPrefab: Specifies a prefab for the cursor model that is automatically instantiated as a child of the
ModelParent
. - ModelParent: Defines the parent transform for the instantiated model prefab. If not set, it defaults to the cursor's transform.
- Model: Directly references an existing cursor model in the scene. If set, it bypasses the instantiation of
ModelPrefab
. - HideControllerModel: Controls the visibility of the cursor model, allowing for dynamic show/hide operations based on gameplay requirements.
- Radius: Represents the radius of the cursor model if it's a sphere, calculated from the model's mesh bounds.
Note: Proper referencing of the Cursor Model in the Cursor component is crucial to avoid unexpected behaviour.
The default Cursor Model, created with the Haptic Rig, features colored dots to represent the three axes: Forward (blue), Up (green), and Right (red). This design aids in visualizing the device's orientation within the virtual environment. For a calibrated VerseGrip, Forward should align with the pointing direction, and Up with the top face.
Inverse3 Cursor Component
Inverse3Cursor
specifically caters to the Inverse3 device, updating the cursor's local position in Unity to reflect the device's physical position.
VerseGrip Cursor Component
VerseGripCursor
extends functionality to the VerseGrip device, updating the cursor's rotation in Unity to reflect the device's physical rotation.
The useDeviceLocalSpace
setting allows for cursor alignment choices between world or parent object orientations, enhancing design flexibility.
Implementation Details
Upon initialization, cursor components will instantiate the specified ModelPrefab
as a child of ModelParent
if Model
isn't assigned, ensuring visual representation in the scene.
These components synchronize with their associated Device Controllers, adjusting the cursor's position and rotation in real-time to physical device movements.
Both components can be attached to the same GameObject to control its position and rotation or to separate ones for distinct use cases, offering developers a versatile toolset for creating immersive haptic experiences in Unity.