Difference between revisions of "OptiTrack Unreal Engine LiveLink Plugin"

(5. Configure the LiveLinkController component)
(Live Link Camera Plugin)
Line 100: Line 100:
 
</div>
 
</div>
  
==Live Link Camera Plugin==
+
==Live Link Tracking Objects / Cameras==
 
<div class="padded">
 
<div class="padded">
====1. Configure the plugin under project settings====
+
====1. Add a camera object or a static mesh object that you wish to move====
<div class="padded">
+
Open the project settings and configure the following Default Role settings under the Plugins - Live Link. You will need to expand the settings to change this.
+
*Role &rarr; LiveLinkAnimationRole
+
*Setting Class &rarr; OptiTrackSubjectSettings
+
 
+
[[Image:LiveLink_Camera_ProjectSettings.png|center|thumb|650px|Live Link project settings]]
+
</div>
+
 
+
====2. Connect====
+
<div class="padded">
+
Connect to Motive via LiveLink, each rigid body asset should already have their own translator:
+
 
+
[[Image:LiveLink_Camera_Translator.png|center|thumb|550px|]]
+
</div>
+
 
+
====3. Add a camera object====
+
 
<div class="padded">  
 
<div class="padded">  
Drag a camera or other actor object into your scene from the Place Actors pane.  
+
Add a camera actor from the Place Actors pane or a static mesh from the project into your scene. For the static meshes, make sure their Mobility setting is set to ''Movable''.
  
[[Image:LiveLink_Camera_CameraObject.png|center|thumb|250px]]
+
<center><ul>
 +
<div class="thumblist">[[Image:LiveLink_Camera_CameraObject.png|center|thumb|250px]]</div>
 +
<div class="thumblist">[[Image:LiveLink_Camera_CubeObject.png|center|thumb|360px]]</div>
 +
</ul></center>
 
</div>
 
</div>
  
====4. Add LiveLinkController to the camera====
+
====2. Add LiveLinkController Component====
 
<div class="padded">
 
<div class="padded">
Select the object you want to animate(in this case, a cube mesh), click the “Add Component” button on the details pane, and add LiveLinkController.
+
Select an actor you want to animate, click the “Add Component” button on the details pane, and add LiveLinkController.
  
 
[[Image:LiveLink_Camera_AddLiveLinkController.png|center|thumb|387px]]
 
[[Image:LiveLink_Camera_AddLiveLinkController.png|center|thumb|387px]]
 
</div>
 
</div>
  
====5. Configure the LiveLinkController component ====
+
====3. Configure the LiveLinkController component ====
 
<div class="padded">
 
<div class="padded">
 
Under the Live Link Controller component that has been added, configure the following properties. You will need to expand the settings to change this:
 
Under the Live Link Controller component that has been added, configure the following properties. You will need to expand the settings to change this:
* Live Link &rarr; Subject Representation &rarr; target rigid body asset
+
* Live Link &rarr; Subject Representation &rarr; Target rigid body name
 
* Live Link &rarr; Subject Representation &rarr; Role &rarr; LiveLinkTransformRole
 
* Live Link &rarr; Subject Representation &rarr; Role &rarr; LiveLinkTransformRole
 
* Role Controllers &rarr; Transform Role &rarr; Live Link Transform Controller
 
* Role Controllers &rarr; Transform Role &rarr; Live Link Transform Controller
  
 
[[Image:LiveLink_Camera_ConfigLiveLinkController.png|center|thumb|350px|]]
 
[[Image:LiveLink_Camera_ConfigLiveLinkController.png|center|thumb|350px|]]
</div>
 
  
====6. Check====
+
====4. Check====
 
<div class="padded">
 
<div class="padded">
At this point the camera should be animating in the scene.  
+
Now the objects with the LiveLinkController component attached and configured will be animated in the scene.
 
</div>
 
</div>
 
</div>
 
</div>

Revision as of 10:23, 8 October 2020

Warning2.png

Note: Contents in this page are still preliminary and the instructions are subject to be changed

Overview

This page provides instructions on how to use OptiTrack UE LiveLink plugin.

Plugin Setup


1. [Motive] Setup rigid body streaming in Motive.

Get Motive streaming with at least one rigid body. Make sure the Streaming settings are set up correctly, and the rigid body is active under the Assets pane.

2. [UE] Install the OptiTrack plugins in Unreal Engine (UE).

You can install the OptiTrack - NatNet Streaming Client plugin by putting the plugin files into one of the following directories:

  • A global engine plugin can be placed in C:\Program Files\Epic Games\[Engine Version]\Engine\Plugins
  • A project-specific plugin can be placed in [Project Directory]\Plugins

3. [UE] Enable the plugins in UE project.

Go to Edit → Plugins and enable the OptiTrack - LiveLink plugin as well as the Built-In LiveLink plugin in UE.

OptiTrack - Live Link plugin. Make sure the plugins are placed in the plugins folder either in the project or engine directory.
Built-In Live Link plugin.

4. [UE] Open the LiveLink pane

The LiveLink pane can be accessed from Window → Live Link from the toolbar in UE.

    LiveLine pane in UE.
    LiveLine pane in UE.

5. [UE] Configure and create a new OptiTrack source

In the LiveLink pane under Source options, go to the OptiTrack Source menu and configure the proper connection settings and click Create. Please make sure to use matching network settings configured from the Streaming pane in Motive.

Creating OptiTrack source with client streaming settings.

6. [UE] Check the Connection.

If your settings were correct, then the plugin will list out all of the detected rigid bodies, and they should have green dots next to them signifying that the asset has been created and is receiving data. If the dots are yellow, then either your take is paused, or there is some sort of connection error.

Connected to the rigid body data stream.

Using the Plugin


Live Link Rigid Body Tracking

After you are connected to Motive through the Live Link plugin and have at least one rigid body tracking, then you can start animating an object in Unreal Engine as well.

1. Set up the object to track

The first step is to set up your object to track. To do this, right-click on a skeleton mesh object you would like to track in the content browser, choose → Create → Anim Blueprint. The mesh must be a skeleton mesh.

Creating Anim blueprint.

2. Open Animation Blueprint

This will create an Animation Blueprint of the selected mesh. In the content browser, double-click the created animation blueprint to edit it.

Animation blueprint create in the content browser.

3. Add Live Link Pose to the blueprint

In the blueprint, access the AnimGraph tab. There should be an output pose node in there already. Then right-click in the empty space and search for "Live Link" to find the "Live Link Pose" and add it to the graph.

Adding Live Link Pose node.

4. Connect Live Link pose to the Output Pose

On the Live Link Pose node, you should see the Live Link Subject Name property. Use the dropdown and select the name of a rigid body to use. Then, drag the pose output and connect it to the Output Pose.

Live Link Pose of a Bat rigid body connected to the output pose.

5. Set the retarget asset

Select the “Live Link Pose” node and select the “OptiTrackLiveLinkRetarget” option in the “Retarget Asset” property in the Details pane.

Selecting Retarget Asset.

6. Compile and save

Compile and save the blueprint. Once the changes have been compiled, you should see the object animating according to the rigid body tracking in the mini 3D viewport.

Compiled blueprint with the mesh being animated.

Live Link Tracking Objects / Cameras

1. Add a camera object or a static mesh object that you wish to move

Add a camera actor from the Place Actors pane or a static mesh from the project into your scene. For the static meshes, make sure their Mobility setting is set to Movable.

    LiveLink Camera CameraObject.png
    LiveLink Camera CubeObject.png

2. Add LiveLinkController Component

Select an actor you want to animate, click the “Add Component” button on the details pane, and add LiveLinkController.

LiveLink Camera AddLiveLinkController.png

3. Configure the LiveLinkController component

Under the Live Link Controller component that has been added, configure the following properties. You will need to expand the settings to change this:

  • Live Link → Subject Representation → Target rigid body name
  • Live Link → Subject Representation → Role → LiveLinkTransformRole
  • Role Controllers → Transform Role → Live Link Transform Controller
LiveLink Camera ConfigLiveLinkController.png

4. Check

Now the objects with the LiveLinkController component attached and configured will be animated in the scene.

Live Link Timecode Setup

When the camera system is synchronized to another master sync device and a timecode signal is feeding into eSync, then the received timecode can be used in UE project through the plugin.

1. Check the camera system frame rate.

In Motive, double-check and make sure the camera frame rate is a multiple of the genlock/timecode input. If this is not the case, then you will get warning messages, since there will not be a regular one-to-one assignment of timecode frames/subframes and motion capture frames.

2. Configure Evaluation Mode

In the LiveLink pane, select the OptiTrack source, then set the Evaluation Mode to Timecode under the settings. Once that's done, the Timecode Frame Rate should get set automatically.

    LiveLink Timecode 2.png
    LiveLink Timecode 1.png

3. Create a Timecode blueprint

Click Add New button on the Content Browser and select Blueprint Class. Then, search and select LiveLinkTimecodeProvider as the parent class to add. Name the created blueprint to something such as "OptitrackTimeCode".

    LiveLink Timecode 4.png
    LiveLink Timecode 3.png

4. Set Subject Key

Open the created blueprint and select one of the rigid body asset as the Subject Key, then compile and save it.

LiveLink Timecode 5.png

5. Set Timecode Provider under project settings

From Edit → Project Settings, go to General Settings and for Timecode Provider enter the name of the blueprint created in step 4:

LiveLink Timecode 6.png

6. Check the timecode in the Take Recorder pane

Check that the correct timecode is now seen in the Take Recorder pane.

LiveLink Timecode 7.png