WaveVR_PoseTracker

Older versions (2.99 and before) can be found here: WaveVR_PoseTracker

Contents

Introduction

The easiest way to track poses is to use the WaveVR_PoseTrackerManager.cs script. This script manages all pose tracking behaviors.

This script manages the two scripts below to track poses:

  • WaveVR_DevicePoseTracker.cs: device pose tracking.
  • WaveVR_ControllerPoseTracker.cs: controller pose tracking.

For a GameObject with the component WaveVR_PoseTrackerManager, if you specify the device type to Dominant and the dominant device loses tracking (or disconnected), WaveVR_PoseTrackerManager will hide the children objects of the GameObject.

For the WaveVR sample controller, please see the sample photo below:

_images/wavevr_posetracker08.jpg

Assume that Generic_MC_R(Clone) has the WaveVR_PoseTrackerManager component with the type Dominant.

If the dominant device loses tracking, the children objects (MIA_Ctrl, BeamR, ControllerPointerR) will be hidden (disabled).

Note

  • The GameObject with WaveVR_PoseTrackerManager will NOT be disabled by WaveVR_PoseTrackerManager .

Resources

Prefab

  • WaveVR is located in Assets/WaveVR/Prefabs/
  • Controller Loader is located in Assets/WaveVR/Prefabs/

Scripts

All scripts about tracking poses are located in Assets/WaveVR/Scripts/TrackingPose/

Sample

  • PoseTracker_Test is located in Assets/Samples/PoseTracker_Test/Scene/
  • HelloVR is located in Assets/Samples/HelloVR/Scene/

How to Use

Scene Hierarchy

  1. Open the sample scene PoseTracker_Test.

    _images/posetracker_01.png
  2. Press the Play key to play the scene in editor mode, the Generic_MC_R(clone) controller will be generated with the component WaveVR_PoseTrackerManager .

    _images/posetracker_02.png _images/posetracker_03.png

    Then WaveVR_ControllerPoseTracker will be loaded automatically and configured like WaveVR_PoseTrackerManager .

  3. You can see the head object and the ControllerLoader (a prefab from Assets/WaveVR/Prefabs/) object underneath the WaveVR object.

    This usage demonstrates a controller uses localPosition of the head underneath the same parent.

    In the Inspector of WaveVR, you can see the Y axis rotates 90 degrees. Thus, in editor mode, you have to turn your head around 90 degrees to see FrontCube .

  4. Look at the Inspector of head. You can see the WaveVR_DevicePoseTracker component has Type with WVR_Device_Type_HMD. There is a option named Enable Neck Model.

    _images/posetracker_04.png

    This option takes effect only when the Origin of WaveVR_Render is WVR_Pose Origin Model_Origin On Head_3 DoF.

    When this option is checked, WaveVR will simulate the head position in the 3DoF (rotation only) environment.

Editor Mode

In editor mode, please use the mouse and keyboard to simulate the device poses.

For the head:

  • Rotation: right mouse key + mouse movement.
  • Position: left mouse key + mouse movement.

For the right controller:

  • Rotation: right-alt key + mouse movement.
  • Position: right-shift key + mouse movement.

For the left controller:

  • Rotation: left-alt key + mouse movement.
  • Position: left-shift key + mouse movement.

Note

  • If the Simulate Position option of WaveVR_PoseTrackerManager is set to When No Position or Force Simulation, the position will be updated when using the rotation key.

Script

There is a Timing option in the pose tracker scripts.

If you choose When New Poses, the device pose will be updated before rendering.

If you choose ``When Update`, the device pose will be updated at the end of each frame.

WaveVR_DevicePoseTracker and WaveVR_ControllerPoseTracker listen to event MSG_NEW_POSES in OnEnable

void OnEnable()
{
    WaveVR_Utils.Event.Listen(MSG_NEW_POSES, OnNewPoses);

The pose of an object will be updated in each frame in OnNewPoses.

Also, you can see the Inverse Pos and Inverse Rotation checkboxes in WaveVR_DevicePoseTracker. They are used to inverse the position and rotation of the pose.

For example, when you are looking at a ball and moving left, the ball looks like its moving in the opposite direction (moving to the right).

For advanced uses of inverse, refer to Samples/SeaOfCube/Scenes/SeaOfCube

WaveVR_PoseTrackerManager provices options for pose simulation.

_images/posetracker_05.png

If the Track Position option is checked, the Simulate Position option will show. There are three options:

  • When No Position: If the device does NOT have a position, the tracked object will use the simulation position.
  • Force Simulation: The tracked object use the simulation position anyway.
  • No Simulation: The tracked object do NOT use the simulation position.

If the Simulate Position option is selected as When No Position or Force Simulation, the Follow Head option will show.

Follow Head means that when a controller is put (on a table or another place), the controller should follow the head’s movement in scene.

Note: The head’s position which the controller follows is local position, not world position. A demonstration can be seen in Scene Hierarchy