Main page → OptiTrack Unity Plugin
Virtual Reality Experience
1. [Unity] For developing Android applications in Unity, make sure the environment is set up for Android development: Getting Started with Android Development. Below are some of the important steps:
2. [Unity] Include the OSIG file (oculus signature) in the Project/Assets/Plugins/Android/assets/ directory. See: Oculus Signature File Generator.
3. [Unity] Open the Player Settings (Edit → Project Settings → Player) and check the Virtual Reality Supported box under the XR Settings section. Then add the Oculus SDK under the list of Virtual Reality SDK as shown in the image below.
4. [Unity] In Player Settings under the Other Settings section, there are a few other options that need to be set:
5. [Motive] Under the Data Streaming pane, set the Network Type setting under the Advanced Settings to Unicast.
Note: the plugin currently only supports the Unicast broadcasting for streaming onto Android.
1. [Motive] Set the streaming IP address to the IP address of the router.
2. [Android] Connect the smartphone to the router which the Motive is streaming to.
3. [Unity] Configure the Client object. This can be done using the Client - OptiTrack prefab included in the plugin.
4. [Unity] Configure the HMD object.
5. [Unity] Connect a smartphone into the PC, build and run the project. Make sure network permission is given to the Unity application.
6. [Motive] Double check that Motive is streaming. If everything is set up properly, Motive will provide the tracking data to the phone.
Setup and optimize the motion capture volume as explained in the Getting Started guide or the Hardware Setup documentations. If you plan to install any obstacles (e.g. walls) within the capture volume, make sure they are non-reflective, and place and orient the cameras so that every corner is thoroughly captured by multiple cameras. For typical rigid body tracking, attach the rigid body markers as instructed from the Rigid Body Tracking page.
General Setup Steps
With the HMD bracket, simply attach the active marker bracket onto an CV1 HMD and use the active markers on it to define a rigid body.
When using the OptiTrack Active Marker Kit, active markers are actively labeled individually from their own unique illumination patterns, and only the matching active markers get contributed to the rigid body solve. The biggest benefit from the individual labeling is that markers can be placed in perfectly symmetrical placements among multiple rigid body assets.
When attaching retroreflective markers, make sure markers are securely attached and readily captured by the cameras. For attaching the markers, we recommend using our 20 mm wide and 30 mm tall M4 threaded plastic marker bases with Acrylic adhesives, available at the webstore, to attach the markers onto the HMD.
A markered HMD will be defined as a rigid body in Motive. When placing markers, make sure the placement asymmetry is respected in the arrangement within the HMD. Also, the marker arrangements between multiple HMDs must be incongruent. For more details, read about marker placement from the Rigid Body Tracking page.
In Motive, select the markers that are attached on the HMD and create a rigid body (Hotkey: CTRL + T) as you would do for other rigid bodies. Once the rigid body is created, select the asset and open the Properties pane. The following settings need to be configured for HMD tracking.
Deflection setting is the tolerable distance, in millimeters, that a rigid body marker may deviate from its expected position before it is unlabeled and unassociated with the rigid body. The deflection is set to 4 mm by default. For HMD tracking applications, we recommended lowering this value to 3 or 2. This will reduce the amount of computation required for labeling, and overall latency may be reduced.
The Steaming ID of a rigid body is a number that can be used for referencing the specific rigid body in external applications. Log this value for each rigid body (including the HMD(s)) in the scene. This number will be used to associate the assets in the client applications using the plugin devices.
This setting may need to be modified when tracking HMDs with passive markers. To prevent the swapping of the rigid body definition, set this setting to 4. When tracking multiple HMDs, there could be limitations to a variety of unique marker arrangements that could be achieved. If this value is set to a lower value, a set of three markers on an HMD may be congruent to another set in a different HMD, and the rigid body definitions may be switched in Motive.
After the rigid body definition have been created for the HMD, the position and orientation of the rigid body pivot point need to be carefully adjusted for HMD tracking:
In general, you will be utilizing the HMD calibration tool for precisely positioning and orienting the HMD rigid body. However, if, for some reason, you want to manually position the pivot point without using the HMD Calibration feature, follow the instruction on this page: Manually Calibrating the HMD Pivot Point.
Rigid body pivot can be easily calibrated using the HMD Calibration tool. Supported only for Oculus HMD models only. Does not work with GearVR.
You can also use the HMD Calibration feature to easily calibrate the pivot point of the active marker HMD clips.
Calibration of HMDs with passive markers utilizes both the OptiTrack mocap system and the Oculus Tracker for precisely calculating the location of the pivot point of an Oculus HMD. When using this feature, both systems must be tracking the HMD rigid body.
Tip: Once you have the rigid body asset for the HMD configured, you can export the asset into a TRA file for future uses. Importing the TRA file (e.g. CV1.tra) will load the rigid body (HMD) asset and make it available for use; however, the marker placement must remain unchanged in order to re-load previously created rigid bodies.
Once you have connected the client object and configured the script components on the assets from the scene. Play the scene, and if the properties are correctly configured, the assets in the game scene will be animated according to the position and orientation of the rigid bodies and the HMD in Motive. When playing the scene, the HMD and the assigned actor objects will be placed in respect to their location in Motive’s coordinate system disregards to their position in the editor.
When setting up multiplayer games with wireless clients, it is more beneficial for each client to make direct connection to both the tracking-server (Motive) and the game-server, rather than rebroadcasting the streamed tracking data through the game-server. Then, any of the game related actions that interacts with the tracking data can be processed on the game-server, and this server can send out the corresponding updates to the wireless clients. This allows the wireless clients to only receive both the tracking data or updates without having to send back any information; in other words, minimizing the number of data transfers needed. If wireless clients are sending data there will be a minimum of two transfers on the wireless network, and each transfer of data through wireless network is at risk of latency or lost packets.