Back to the Main page
The OptiTrack Unreal Engine Plugin allows you to stream real-time tracking data from Motive into Unreal Engine 4 (UE4). Using this plugin, tracking data of rigid bodies, skeletons, and HMDs can be streamed from Motive into UE4 projects. This article focuses on how to set up for those different streaming workflows. For basic instructions on how to set up a motion capture system, please refer to the Getting Started guide instead.
The OptiTrack Unreal Engine Plugin is divided into two parts:
Once the plugins are enabled, they can be used to connect and receive streaming data from Motive by setting up an OptiTrack Client Origin object in the Unreal Engine level.
This plugin is supported for the following versions of the Unreal Engine, and it also requires the corresponding version of Oculus runtime as indicated in the table.
First of all, follow the below instructions to set up the data streaming settings in Motive. Once this is configured, Motive will be broadcasting tracking data onto a designated network interface where client applications can receive them.
Open the Data Streaming pane in Motive and set the following settings:
Next step is to configure the client plugin inside UE4. Please follow below instructions to install and configure the OptiTrack Unreal Engine plugin to receive the streamed tracking data.
C:\Program Files\Epic Games\4.##\Engine\Plugins
Once the OptiTrack - NatNet Streaming Client plugin is enabled, OptiTrack Client Origin will be available in the UE4 . This client origin object will be used as the baseline node for establishing the connection to Motive.
The OptiTrack Client Origin class enables the Unreal Engine (client) to communicate with Motive where the rigid body, skeleton, and HMD tracking data are streamed from. The client origin can be added simply by drag-and-dropping the OptiTrack Client Origin from the Modes panel into the level in UE4. Once the client origin is placed within the level, its position and orientation will reconcile the global origin of Motive in Unreal Engine. In other words, the tracking data will be represented according to where this Client Origin object is positioned and how it is oriented.
Global Origin: Both position and orientation of the OptiTrackClientOrigin will represent the global origin of the tracking volume within Motive.
Connecting to a designated IP address
Advance settings: Auto-initialize
Actor objects in Unreal Engine can be animated using rigid body tracking data from Motive. Once the OptiTrack - NatNet Streaming Client plugin is enabled in the project, OptiTrack Rigid Body component will be available to use. By attaching this component onto an actor, you can animate its child actors according to the movement of a rigid body in Motive. Each rigid body component is given a Trackable ID value, and tracking of a rigid body asset with the matching Streaming ID, in Motive, will be used to update the transform of the target actor in Unreal Engine.
You can also use the OptiTrack Rigid Body Actor prefab under the Modes panel. This is simply a blank actor with just the OptiTrack Rigid Body component attached to it, and you can use this to easily associate the objects within the scene:
Characters in Unreal Engine can be animated using skeleton tracking data from Motive. There are two different approaches to this: skeleton bone mapping and skeleton retargetting.
For plugin versions above 1.9.2, the skeleton component can be used to allow streaming of the skeleton via bone mapping. This means that the motion of each skeleton bone in Motive can be projected to the bones of the character model. Please note that this is different from skeleton retargeting, the bone segments in Motive get mapped directly to the character model (bone mapping) instead of being translated into something that is usable by a more abstract biped model (retargeting). The instructions on setting up the skeleton component are documented under the following page:
Go to: Unreal Engine Skeleton Streaming
Skeleton tracking data can also be integrated into Unreal Engine via a 3D retargeting process. This can be accomplished through a third party software, such as IKinema, that retargets captured 3D data onto a character to produce realistic motion in a scene. For more information, contact us.
Notes for IKinema LiveAction for UE 4.18.
C:\Program Files\Epic Games\UE_4.18\Engine\Plugins\UE_4.18\OptiTrack\OptitrackNatNet\ThirdParty\NatNetSDK\lib
C:\Program Files\Epic Games\UE_4.18\Engine\Plugins\LiveAction\Source\ThirdParty\NatNet\NatNetSDK\lib\
When needed, you can also draw labeled marker data from Motive into the scene in UE. In most applications, you do not have to draw the markers as rigid body data and the skeleton data will be used instead; however, getting markers generated in the scene may be helpful for debugging purposes. To enable drawing of the markers, expand the OptiTrackClientOrigin component properties, and set the Draw Markers to true. Also, the Labeled Markers in the data streaming settings of Motive must be enabled as well.
OptiTrack motion capture systems can be used to track head mounted displays (HMD) and integrate the tracking data into Unreal Engine for VR applications. For instructions on integrating HMD tracking data into Unreal Engine, please refer to the corresponding pages:
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 disregards to their position in the editor.
When setting up multiplayer games on 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.