VRInput Current { get; set; }

robot_2Generated
code_blocksInput

Description

The Current property provides access to the current instance of the VRInput class. This instance represents the active VR input context, allowing you to interact with and retrieve information about the VR environment and input devices.

Usage

Use the Current property to access the active VR input instance. This is particularly useful when you need to query or manipulate VR input data, such as controller states or head position, within your application.

Example

// Access the current VRInput instance
VRInput currentVRInput = VRInput.Current;

// Example: Retrieve the position of the VR headset
Transform headTransform = currentVRInput.Head;
Vector3 headPosition = headTransform.Position;

// Example: Check if the left hand is dominant (note: this property is obsolete)
bool isLeftHandDominant = currentVRInput.IsLeftHandDominant;

// Example: Get the list of tracked objects
var trackedObjects = currentVRInput.TrackedObjects;
foreach (var trackedObject in trackedObjects)
{
    // Process each tracked object
}