LogoLogo
WebsiteSupportDownloadsForumsQuick LinksContact Us
v3.1
v3.1
  • OptiTrack Documentation
  • WHAT'S NEW
    • What's New in Motive 3.1
  • QUICK START GUIDES
    • Quick Start Guide: Getting Started
    • Quick Start Guide: Prime Color Camera Setup
    • Quick Start Guide: Precision Capture
    • Quick Start Guide: Tutorial Videos
    • Quick Start Guide: Active Marker Tracking
    • Quick Start Guide: Outdoor Tracking Setup
  • HARDWARE
    • Cameras
      • Ethernet Cameras
        • PrimeX 120
        • PrimeX 41
        • PrimeX 22
        • PrimeX 13
        • PrimeX 13W
        • SlimX 13
        • Prime Color
      • USB Cameras
        • Slim 3U
        • Flex 13
        • Flex 3
        • Duo 3
        • Trio 3
        • Adjusting Global Origin for Tracking Bars
    • Prepare Setup Area
    • Camera Mount Structures
    • Camera Placement
    • Ethernet Camera Network Setup
      • General Overview and Specs
      • Windows 10 Network Settings
      • Cabling and Load Balancing
      • Switch Configuration for PrimeX 120
      • NETGEAR ProSafe GSM7228S: Disabling the Broadcast Storm Control
      • White/Blacklisting Cameras
    • USB Camera System Setup
      • USB Camera Network Overview and Specs
      • Duo 3 and Trio 3 Setup
      • Tracking Bar Coordinate System
        • Transforming Coordinate System: Global to Local
    • Aiming and Focusing
    • Camera Status Indicators
  • MOTIVE
    • Installation and License Activation
    • Motive Basics
    • Calibration
      • Continuous Calibration
      • Continuous Calibration (Info Pane)
      • Calibration Squares
    • Markers
    • Assets
      • Gizmo Tool: Translate, Rotate, and Scale
    • Rigid Body Tracking
      • Aligning Rigid Body Pivot Point with a Replicated 3D Model
    • Skeleton Tracking
    • Trained Markersets
    • IMU Sensor Fusion
    • Data Recording
      • Data Types
    • Labeling
    • Data Editing
    • Data Export
      • Data Export: BVH
      • Data Export: C3D
      • Data Export: CSV
      • Data Export: FBX
      • Data Export: TRC
    • Data Streaming
    • Camera Video Types
    • Audio Recording
    • Motive HotKeys
    • Measurement Probe Kit Guide
    • Motive Batch Processor
    • Reconstruction and 2D Mode
  • MOTIVE UI PANES
    • Settings
      • Settings: General
      • Settings: Assets
      • Settings: Live Pipeline
      • Settings: Streaming
      • Settings: Views
      • Settings: Mouse and Keyboard
      • Settings: Audio
    • Assets Pane
    • Builder Pane
    • Constraints Pane
      • Constraints XML Files
    • Calibration Pane
    • Data Pane
    • Devices Pane
    • Edit Tools Pane
    • Graph View Pane
    • Info Pane
    • Labels Pane
    • Log Pane
    • Probe Pane
    • Properties Pane
      • Properties Pane: Camera
      • Properties Pane: Force Plates
      • Properties Pane: NI-DAQ
      • Properties Pane: OptiHub2
      • Properties Pane: Rigid Body
      • Properties Pane: Skeleton
      • Properties Pane: Take
      • Properties Pane: Trained Markerset
      • Properties Pane: eSync2
    • Status Panel
    • Toolbar/Command Bar
    • Control Deck
    • Viewport
  • PLUGINS
    • OptiTrack Blender Plugin
      • OptiTrack Blender Plugin
    • OptiTrack Unreal Engine Plugin
      • Unreal Engine: OptiTrack Streaming Client Plugin
      • Unreal Engine: OptiTrack Live Link Plugin
        • Quick Start Guide: Real-Time Retargeting in Unreal Engine with Live Link Content
        • Unreal Editor for Fortnite (UEFN): OptiTrack Plugin for Live Link Hub
        • Unreal Engine: Live Link Camera Stream Setup
        • Live Link Content: Active Puck Static Meshes
      • Unreal Engine: MotionBuilder Workflow
      • Unreal Engine: HMD Setup
      • Unreal Engine VCS Inputs
    • OptiTrack Unity Plugin
      • Unity: HMD Setup
    • OptiTrack OpenVR Driver
    • Autodesk Maya
      • Autodesk Maya: OptiTrack Insight VCS Plugin
    • Autodesk MotionBuilder
      • Autodesk MotionBuilder Plugin
      • Autodesk MotionBuilder: OptiTrack Skeleton Plugin
      • Autodesk MotionBuilder: OptiTrack Optical Plugin
      • Autodesk MotionBuilder: OptiTrack Insight VCS Plugin
      • Autodesk MotionBuilder: Timecode Data
    • OptiTrack Peripheral API
    • External Plugins
      • Houdini 19 Integration
  • ACTIVE COMPONENTS
    • Active Components Hardware
      • Active Puck
      • CinePuck
      • BaseStation
      • Information for Assembling the Active Tags
      • Manus Glove Setup
    • Configuration
      • Active Batch Programmer
      • Active Hardware Configuration: PuTTY
      • Active Component Firmware Compatibility
    • Active Marker Tracking
      • Active Finger Marker Set
  • SYNCHRONIZATION
    • Synchronization Hardware
      • External Device Sync Guide: eSync 2
      • External Device Sync Guide: OptiHub2
    • Synchronization Setup
    • OptiTrack Timecode
  • VIRTUAL PRODUCTION
    • Unreal Engine: OptiTrack InCamera VFX
    • Entertainment Marker Sets
    • PrimeX 41
  • MOVEMENT SCIENCES
    • Movement Sciences Hardware
      • General Motive Force Plate Setup
      • AMTI Force Plate Setup
      • Bertec Force Plate Setup
      • Kistler Force Plate Setup
      • Delsys EMG Setup
      • NI-DAQ Setup
      • Multiple Device Setup
    • Movement Sciences Marker Sets
      • Biomechanics Marker Sets
      • Biomech (57)
      • Rizzoli Marker Sets
    • For Visual3D Users
    • Prime Color Camera Setup
      • Prime Color Setup: Required Components
      • Prime Color Setup: Hardware Setup
      • Prime Color Camera Setup: Camera Settings
      • Prime Color Camera Setup: Prime Color FS Calibration
      • Prime Color Setup: Data Recording / Export
      • Prime Color Camera Setup: FAQ / Troubleshooting
      • Prime Color Camera Setup: Windows Network Settings
  • VIRTUAL REALITY
    • VR Plugins
      • VR Unreal Engine
        • OptiTrack Unreal Engine Plugin
        • Unreal Engine: OptiTrack Live Link Plugin
          • UE5.1 Live Link Retarget External Workaround
        • Unreal Engine: Using the OptiTrack Streaming Client Plugin
        • Unreal Engine VCS Inputs
      • VR Unity
        • OptiTrack Unity Plugin
      • VR OpenVR
        • OptiTrack OpenVR Driver
    • VR HMD Setup
      • Unreal Engine: HMD Setup
      • Unity: HMD Setup
      • Manually Calibrating the HMD Pivot Point
      • Sync Configuration with an HTC Vive System
    • SlimX 13
    • Active Marker Tracking
      • Active Finger Marker Set
    • Synchronization Hardware
      • External Device Sync Guide: eSync 2
      • External Device Sync Guide: OptiHub2
  • ANIMATION
    • Autodesk Maya
      • Autodesk Maya: OptiTrack Insight VCS Plugin
    • Autodesk MotionBuilder
      • Autodesk MotionBuilder Plugin
      • Autodesk MotionBuilder: OptiTrack Skeleton Plugin
      • Autodesk MotionBuilder: OptiTrack Optical Plugin
      • Autodesk MotionBuilder: OptiTrack Insight VCS Plugin
      • Autodesk MotionBuilder: Timecode Data
  • ROBOTICS
    • MoCap4ROS2 Setup
    • OptiTrack Robot Applications
    • Outdoor Tracking Setup
  • DEVELOPER TOOLS
    • Developer Tools Overview
    • Camera SDK
      • Class: cCameraModule
      • Class: cUID
    • Motive API
      • Motive API: Quick Start Guide
      • Motive API Overview
      • Motive API: Function Reference
      • Motive API Camera Calibration
    • NatNet SDK
      • NatNet 4.1
      • NatNet: Class/Function Reference
      • NatNet: Creating a Managed (C sharp) Client Application
      • NatNet: Creating a Native (C++) Client Application
      • NatNet: Data Types
      • NatNet: Matlab Wrapper
      • NatNet: Migration to NatNet 3.0 libraries
      • NatNet: Remote Requests/Commands
      • NatNet: Sample Projects
      • NatNet: Unicast Data Subscription Commands
      • Latency Measurements
    • Peripheral API: Glove Devices
  • SKELETON MARKER SETS
    • Full Body
      • Baseline (41)
      • Core (50)
      • Biomech (57)
      • Conventional (39)
    • Full Body + Fingers
      • Baseline + Passive Fingers (49)
      • Baseline + Active Fingers (57)
      • Core + Passive Fingers (54)
      • Core + Active Fingers (62)
    • Upper
      • Baseline Upper (25)
      • Conventional Upper (27)
    • Lower
      • Baseline Lower (20)
      • Helen Hayes Lower (19)
      • Conventional Lower (16)
    • Hand and Fingers
      • Left/Right Hand (4) Active
      • Left/Right Hand (10) Active + Passive
      • Active Finger Marker Set
    • Glove Device Setup
      • Manus Glove Setup
      • StretchSense Glove Setup
    • Rizzoli Marker Sets
    • Entertainment Marker Sets
    • Rigid Body Skeleton Marker Set
  • GENERAL TROUBLESHOOTING
    • Licensing Troubleshooting
    • Windows 11 Optimization for Realtime Applications
    • Network Troubleshooting
    • Troubleshooting Q&A
    • Running Motive on High DPI Displays
    • Firewall Settings
Powered by GitBook
On this page
  • Overview
  • Versions Requirements
  • Motive Setup (Server)
  • Streaming Setup
  • Unity Setup (Client)
  • Import Plugin Package
  • Setting Up the Client Object
  • Animating a Rigid Body
  • Animating a Skeleton
  • Animating a Trained Markerset
  • Animating Markers, Etc.
  • Integrating HMDs
  • Wireless Multiplayer Setup

Was this helpful?

Export as PDF
  1. PLUGINS

OptiTrack Unity Plugin

PreviousUnreal Engine VCS InputsNextUnity: HMD Setup

Last updated 6 months ago

Was this helpful?

Overview

The allows you to stream real-time Rigid Body, Skeleton, and HMD tracking data from Motive into Unity. Using the streamed data, objects and characters in the scene can be animated. The plugin contents are distributed in unitypackage format, and you can simply load this file into Unity projects to import its contents. Once imported, included C# scripts can be used for instantiating a client origin and receiving the tracking data. This article focuses on how to set up and use the plugin.

Versions Requirements

  • Unity 2022 LTS through Unity 6 LTS

  • Visual Studio 2019 or latest Visual C++ Redistributable

Notes on HMD Integration

Motive Setup (Server)

Streaming Setup

Streaming in Motive

  • Enable - Turn on the Enable setting at the top of the NatNet section.

  • Local Interface - Choose the desired IP network address from this dropdown to stream data over.

  • Transmission Type

    • Unicast subscribes only to the data selected and normally uses less network bandwidth. Use this method when only streaming Rigid Bodies and/or Skeletons. This is especially advised if streaming data over WiFi.

    • Multicast transmission is required when streaming Trained Markersets. This method requires more bandwidth, therefore we recommend enabling only the desired data types. For example, When tracking HMDs, we recommend disabling Marker streaming.

Additional Streaming Tips

  • To stream data from Edit mode, a capture recording must be playing back in Motive.

  • We recommend running Motive and Unity on different computers, so the applications are not competing for processing resources.

  • When streaming the data over a WiFi network, Unicast transmission must be used.

Unity Setup (Client)

Import Plugin Package

While in the Unity project, double-click on the plugin unitypackage file and import the plugin assets into the project. When the package has been successfully imported, the following contents will be available within the project:

Plugin Contents

Folder
Content Description

Assets/OptiTrack

All of the Unity plugin contents are included in this folder.

Assets/OptiTrack/Scripts

This is the folder that you will mainly use. It contains plugin C# script components that can be imported into Unity objects for receiving streamed data.

Assets/OptiTrack/Plugins

This folder contains the plugin libraries and header files.

Assets/OptiTrack/Prefabs

This is the easiest place to get started. This folder contains premade objects for setting up a streaming client, tracking a Rigid Body, and retargeting a Skeleton.

Assets/OptiTrack/Scenes

This folder contains sample Unity scene that includes pre-configured client, Rigid Body, and Skeleton objects.

Setting Up the Client Object

In order to receive tracking data from a server application (e.g. Motive), a client object must be set up. The OptitrackStreamingClient.cs script can be attached to any object to stream data relative to that object. Typically, this script is attached to an empty object or loaded in using the "Client - OptiTrack" prefab object in the Assets/Optitrack/Prefabs folder.

  • [Unity] Under the Prefabs folder, import the "Client - OptiTrack" prefab object into the scene, or attach OptitrackStreamingClient.cs script onto an empty object.

  • [Unity] In the streaming Client object, configure the connection settings to match the streaming settings in Motive.

  • Server Address - IP address of the PC that the server application (Motive) is running on.

  • Local Address - Local IP Address of the PC that the client application (Unity) is running on. (Typically, this looks similar to the Server Address except maybe the last digits.)

  • Connection Type - Must match Motive. Unicast is recommended.

  • [Unity] If you wish to receive tracking data from more than one server instances, you may create multiple objects with the client script attached.

Position Data in Unity

Although it is not strictly necessary, you may find it helpful to organize your tracked objects as children of the streaming Client object. This will allow you to adjust the position of the Client object to adjust the position of all streamed objects relative to the Client object.

Animating a Rigid Body

  1. [Unity] On an object that you wish to animate, attach the OpitrackRigidBody.cs script.

  2. [Unity] In the Streaming Client entry, link the Client object in which the OptitrackStreamingClient.cs script is attached. By default, it searches for an existing client instance, but this must be specified when there are more than one streaming client objects.

  3. [Motive] Make sure Motive is tracking and streaming the data.

  4. [Unity] Play the scene. The linked object will be animated according to the associated Rigid Body movement in Motive.

Animating a Skeleton

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.

Steps

  1. [Unity] On Unity characters, attach OptitrackSkeletonAnimator.cs script as one of its components.

  2. [Unity] For the Streaming Client entry, link the Client object in which the OptitrackStreamingClient.cs script is attached. By default, it searches for an existing client instance, but this must be specified when there are more than one streaming client objects.

  3. [Unity] Enter Skeleton Asset Name which is assigned in Motive

  4. [Unity] For the Destination Avatar entry, link to the character's avatar component.

  5. [Motive] Make sure Motive is tracking and streaming the data.

  6. [Unity] Play the scene. When everything is set up properly, the linked avatar in Unity will be animated according to the streamed Skeleton in Motive. The position of the actor will be in its reference position as explained above.

Animating a Trained Markerset

  1. [Motive] Export the asset using the FBX Binary format, with the following settings:

  • Export Skeletons is Enabled

  • Bone Naming Convention is set to FBX

  • Markerset Nulls is Enabled

  • Skeletal Mesh is Enabled

  • Remove Bone Naming Prefix is Enabled

Make note of the asset name in Motive to ensure the same name is used for the asset after it's imported into Unity.

  1. [Motive] On the Streaming tab of the Settings panel, set the following properties:

  • Transmission type is set to Multicast

  • Skeleton Coordinates is set to Local

Trained Markersets have their own bone naming convention and are not affected by the Bone Naming Convention setting on the Streaming tab.

  1. [Unity] Select Assets in the Project tab then right-click in the Assets pane and select Import New Asset... from the context menu.

  1. [Unity] Drag the newly imported asset into the scene. In the Hierarchy tab, drag the asset to nest under the Origin for the Scene.

  1. [Unity] Select the imported asset from the Hierarchy tab. In the Transform section of the Inspector tab, zero out the position and rotation values to place the asset at the local origin.

  1. [Unity] Select the origin from the Hierarchy tab. The OptiTrack Streaming Client (Script) section will appear in the Inspector tab. Ensure the following properties are set:

  • Server Address is set to the IP address for the Motive PC. Use 127.0.0.1 for loopback transmission.

  • Local Address is set to the IP address for the Unity PC. Use 127.0.0.1 for loopback transmission.

  • Connection type is Multicast.

  • Skeleton and T Markerset Coordinates are both set to Local.

  • Bone Naming Convention is set to FBX by default. This setting does not apply to trained markerset assets.

  • Draw T Markerset Markers is checked (enabled).

Trained Markerset will not stream into Unity in unicast or using global coordinates.

  1. [Motive] Ensure that NatNet streaming is enabled.

  2. [Unity] With the asset selected in the Hierarchy tab, click the Add Component button in the Inspector tab. Search for OptiTrack, then select OptiTrack Trained Markerset from the list of available options.

  1. [Unity] In the T Markerset Asset Name field, rename the imported asset to match the name in Motive.

Unity does not include a simple method for retargeting trained markersets. Many Unity users perform retargeting functions using third-party applications.

Animating Markers, Etc.

  1. [Unity] On the OptiTrack Streaming instance, enable the Draw Markers, "Draw Cameras", or "Draw Force Plates" setting(s).

  2. [Motive] Make sure that marker streaming is enabled in Motive if you wish to visualize markers.

  3. [Unity] Make sure the streaming setting is set up correctly, and play the scene.

  4. [Unity] Each marker, camera, or force plate will be drawn in the scene, as shown in the screenshot below. (Note: Only markers will animate.)\

Integrating HMDs


Supported HMDs

At the time of writing, the following HMDs are supported:

  • HTC VIVE

  • HTC VIVE Pro

  • HTC VIVE Pro 2

  • Valve Index

  • HP Reverb

Wireless Multiplayer Setup

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.

The HTC VIVE, VIVE Pro, VIVE Pro 2, Valve Index, and HP Reverb HMDs can be integrated through the .

To download the driver, visit the of the OptiTrack page.

From Motive, tracking data can be streamed in real-time, either from a live capture (Live Mode) or recorded data (Edit Mode). Settings are configured in , on the tab.

Click the button in the lower right corner of the Control Deck to open the . Configure the settings below:

[Motive] In the , configure the desired connection settings.

[Unity] For the Rigid Body ID entry, input the streaming ID of corresponding Rigid Body asset in Motive. The streaming ID can be found, and changed, under the .

By integrating with Unity's animation system, , 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.

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 Unreal Engine, please refer to the corresponding page .

OptiTrack OpenVR Driver
Plug-ins section
Downloads
Application Settings
Streaming Settings
Streaming Settings
Rigid Body properties
Mecanim
Unity: HMD Setup
OptiTrack Unity3D Plugin
Streaming Settings
Streaming tracking data into Unity.
Data Streaming settings in Motive.
Unity plugin files.
Client object in Unity and the corresponding Motive data streaming network settings. Click image to enlarge.
Position data in unity. Click image to enlarge.
OptiTrack Rigid Body configuration along with the Rigid Body properties in Motive. Configured Streaming ID must match the Rigid Body ID designated from the client side. Click image to enlarge.
OptiTrack Skeleton Animator script configuration from a character in Unity.
Settings to export a Trained Markerset asset for use in Unity.
Import an Asset into Unity.
Imported Trained Markerset nested under the Origin.
Inspector Tab.
OptiTrack Streaming Client (script) settings for Trained Markersets
Add Component in Unity.
Trained Markerset Asset Name in Unity.
Skeleton labeled markers drawn in Unity scene.