Skip to content

ExPresS XR Rig

eisclimber edited this page Nov 3, 2024 · 5 revisions

ExPresS XR Rig

class in ExPresSXR.Rig / Extends MonoBehavior
GameObject instantiable via ExPresS XR/XR Rig/...

Description

The main configurable GameObject for XR, having all necessary components for any form of interaction as children of this one GameObject.

The rig supports three different types of input methods:

  • Controller: Used with a complete VR Headset and controllers. Using this allows for the most immersive XR experience.
  • Head Gaze: Used VR headsets without requiring controllers but can be used for smartphone applications too.
  • Eye Gaze: Can be used with eye-tracking compatible headsets, also not requiring controllers. As we do not have a compatible headset, we are unable to test it. It is included as it is part of Unity's samples and was not changed by ExPresS XR.

Movement is dependent on the selected Input Method. While Head- and Eye-Gaze only allow for teleportation or no movement, there are the following possibilities when using controllers:

  • Teleportation: Casts a ray and teleports the rig to the target position of the ray. At the end of the ray is a visual indicator (reticle) that highlights teleportation targets. These targets are defined by the GameObjects with a TeleportationArea- and TeleportationAnchor-Component. Note: In case of HeadGaze the ray will not be rendered; only the reticle will be shown. The reticles must be added to the teleportation areas and anchors, as otherwise they will be shown with all interactions).
  • Continuous Move: Moves the rig continuously as if the user would move in a video game. This might cause motion sickness for some people!
  • Continuous Turn: Turns the rig continuously in the direction the joystick was leaned. This cannot be combined with Snap Turn and is usually paired with Continuous Move.
  • Snap Turn: Turns the rig in 45-degree (can be changed) steps in the direction the joystick was moved. This cannot be combined with Continuous Turn and is usually paired with Teleportation.
  • (Single Hand) Grab Motion: Users can grab the air and pull the world towards them.
  • (Two Handed) Grab Motion/Grab Manipulation: Expansion of "Single Hand Grab Motion"-Movement, but both controllers can be used together to rotate and scale the environment.
  • No Movement: If nothing is enabled, the rig won't move, but the whole rig itself can still be moved externally.

These movement options can be configured by selecting one of the rig's Movement Presets. Per default, the controls are split between hands in a way known from gamepads or most common VR games (e.g., turn with the right joystick and move with the left). For a detailed description of the controls, please check the docs at Workflow/MovementAndControls.md. The exact behavior of each movement type can be configured via the Components of the rig's "Locomotion System".
Choosing Custom allows for full control over the underlying HandControllers to create a custom behavior.

Apart from moving, there are various options for interacting with the world, most of which are configurable by setting them via the configuration options:

  • Direct: Grabbing and holding objects with their hands
  • Poke: Poking objects with their hand (index finger) interacts with objects
  • Ui Poke: Poking can be used with Ui. Requires Poke Interaction to be enabled.
  • Show Poke Reticle: Will show a poke reticle. All Renderers form the poke reticle and will be activated accordingly.
  • Ray: Ray interaction from afar is enabled.
  • Ray Anchor Control: Leaning the joystick of a hand holding an object will move and turn it. If the interactable object is capable of scaling, this will be done instead.
  • Ui Ray: The ray can be used with Ui. Requires Poke Interaction to be enabled.
  • Choose Teleport Forward: Turning the joystick during teleport mode allows choosing the direction one is facing after the teleport.
  • Cancel Teleport Possible: Pressing the grab button while in teleport mode will cancel the teleport mode. Use it with care, as this can be very confusing!
  • Scale Grabbed Objects: Objects can be scaled with the joystick of the hand holding in, similar to "Ray Anchor Control"
  • Climb: Allows interaction with ClimbInteractables which are used for climbing. The exact behavior can be configured via the Components of the rig's "Locomotion System".
  • Climb Control Gravity: Will temporarily disable gravity while climbing, as this causes heavy jittering. This is highly recommended when climbing with gravity.

The application will be rendered directly to the VR headset via Unity's XROrigin. There is an additional (UI-)Camera for rendering anything that should be rendered as an overlay, most commonly some sort of HUD. As this is done via special layers, make sure that if you add a new rendering layer, you add it to the main camera!

It is also possible to create and save a custom XR Rig as a prefab. After editing an XR Rig to your likings, the Save as Custom XR Rig-Button in the inspector can be pressed. This will save (and override) your "Custom XR Rig", making it instantiable via ExPresS XR/XR Rig/Custom (Saved).

Hint: For further descriptions of the components, take a look at the documentation of the properties in this document, the components of ExPresS XR and Unity XR.

Members

Public Properties

  • InputMethodType inputMethod: How the rig is controlled, either per controller, via Head Gaze or Eye Gaze.
  • MovementPreset movementPreset: Presets of how the player can move through space. The editor will display only those presets that can be used with the selected inputMethod.
  • InteractionOptions interactionOptions: Flags for enabling different interaction options with controllers. This will only be displayed when controllers are used. See Hand Controller Manager for a more detailed description.
  • HandModelMode handModelMode: Determines how the controllers/hands are rendered in the VR.
  • bool handModelCollisions: Enables or disables physical collisions of the controllers/hands with other objects in the VR.
  • bool headGazeCanReselect: Allow reselection of currently hovered Interactable with HeadGaze. Only avalable with Head Gaze.
  • float headGazeTimeToSelect: Determines how long in seconds the head must be kept focussed on an interaction for it to be (re-)selected. Only avalable with Head Gaze.
  • HeadGazeReticle headGazeReticle: Reference to the HeadGazeReticle that is displayed as interaction indicator and crosshair for Head Gaze.
  • HandControllerManager leftHandController: Reference to the left HandControllerManager of the ExPresS XR Rig.
  • HandControllerManager rightHandController: Reference to the right HandControllerManager of the ExPresS XR Rig.
  • XRGazeInteractor eyeGazeController: Reference to the XRGazeInteractor for EyeGaze-Interactions of the ExPresS XR Rig.
  • HeadGazeController headGazeController: Reference to the HeadGazeController of the ExPresS XR Rig.
  • bool headCollisionEnabled: Prevents the players Camera from clipping through Objects and looking inside them by actively puhing the player back.
  • bool showCollisionVignetteEffect: Shows a vignette effect (corners get blurry) if the players Camera is clipping through Objects and looking inside them. Does not require headCollisionEnabled to be enabled to work.
  • LocomotionManager: Reference to the LocomotionManager of the ExPresS XR Rig.
  • FadeRect fadeRect: Reference to the fadeRect of the ExPresS XR Rig.
  • PlayerHeadCollider playerHeadCollider: Must be a PlayerHeadCollider-Component attached to the Main Camera GameObject.
  • Camera hudCamera: Camera that renders the hud. Should be configured as overlay for the Main Camera of the XR Rig.
  • Canvas hud: Canvas that acts as a hud for the rig.
  • ScreenCollisionIndicator screenCollisionIndicator: A reference to the rig's ScreenCollisionIndicator.
  • GameObject teleportValidReticle: Prefab of the reticle used for indicating a valid teleport for controllers. Will be overwritten by the teleportation area/anchors reticle. When using teleport with head gaze the reticles must be added to the TeleportationAreas instead.
  • GameObject teleportInvalidReticle: Prefab of the reticle used for indicating an invalid teleport for controllers. Will be overwritten by the teleportation area/anchors reticle. When using teleport with head gaze the reticles must be added to the TeleportationAreas instead.
  • GameTabDisplayMode gameTabDisplayMode: The way the 'Game'-view displays the rig's camera when entering play mode. Can be changed at runtime at the top right in the 'Game'-tab.

Public Methods

  • void FadeToColor(bool instant = false): Public wrapper function that calls FadeToColor() on the FadeRect if the reference was set.
  • void FadeToClear(bool instant = false): Public wrapper function that calls FadeToClear() on the FadeRect if the reference was set.
  • void ApplyCurrentMovementPreset(): Used Internally. Validates and applies the current MovementPreset.
  • void ApplyCurrentInteractions(): Used Internally. Applies the current InteractionOptions to the HandControllerManagers.
  • void EditorRevalidate(): Used Internally. Used by the editor to reflect changes without causing an error for changing some things during OnValidate().

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally