Main page → OptiTrack Unity Plugin
Notes on HMD Integration
Deprecated support for Oculus HMDs:
From Motive, the tracking data can be streamed in real-time either from a live capture (Live Mode) or recorded capture (Edit Mode). The streaming settings are configured in the Data Streaming pane, and in this pane, the Broadcast Frame Data must be enabled to start streaming the data to a local network interface designated by the IP address in the Local Interface section.
For the best performance, disable streaming of unnecessary data types is recommended. This will reduce the size of data packets and simplify the parsing process. Please make sure only necessary data types are enabled for streaming:
Open the Data Streaming pane in Motive and configure the settings below:
After you have created a new Unity project or loaded an existing one, double-click on the plugin unitypackage file from the folder you had it saved to after you downloaded it from the OptiTrack website. This should open an Import Unity Package window. Click Import. When the package has been successfully imported, the following contents will be available within the project:
In order to receive tracking data from a server application (e.g. Motive), a client object must be set up. A client object can be any object within a scene in Unity, and it can be assigned by attaching OptitrackStreamingClient.cs script. This script receives the tracking data from the connected server application (e.g. Motive) and makes the data available within the scene. You can either attach the client script onto an existing object or an empty object, or you can just import the sample from the Assets/Optitrack/Prefabs folder.
By integrating with Unity's animation system, Mecanim, the Unity3D plugin allows Motive to stream full body skeleton data. The skeleton tracking data from Motive is streamed out as hierarchical bone segment orientations, and this data is fed into the Unity's Mecanim system which allows animating characters with different proportions.
Note: At the time of writing, Mecanim does not support explicit goals for inverse kinematics end-effectors when using real-time retargeting. In addition, you may observe a difference in the overall scale of the position data between the retargeted skeletal animations and streamed rigid bodies. These two limitations may lead to inconsistencies with actors interacting with rigid body props, and will hopefully be addressed in a future version of the integration.
OptiTrack motion capture systems can be used to track head-mounted displays (HMD) and integrate the tracking data into Unity for unique VR applications. For instructions on integrating HMD tracking data into Unity, please refer to the corresponding page Unity: HMD Setup.
At the time of writing, the following HMDs are supported:
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 in regards 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.