Page 1 of 3

Motive to Unity

Posted: Mon Nov 17, 2014 3:41 pm
by BradleyNewman
I've extended some of the NatNet 2.7 SDK to enable streaming tracking data for multiple rigid bodies from Motive Body 1.7 Beta 2 into Unity. The NatNet 2.7 SDK includes a UnitySample application that by default only streams data for a single rigid body; this sample has been extended slightly to allow for streaming multiple rigid bodies. UnitySample.exe streams data from Motive to Unity over UDP as an XML stream. The UnitySample Unity project code has been extended substantially to streamline the process of streaming tracking data into Unity.

You can download "Motive To Unity" v1.0 from here: (with source code for UnitySample.exe and the Unity project and an included tutorial): ... sp=sharing

Since our research lab is doing VR research we are particularly interested in the lowest latency possible, so if anyone has ideas for how to reduce latency over UDP I'd love to hear your ideas. In the future I'm planning to stream data via a native C++ DLL into Unity in the hope that latency is reduced further.

Bradley Newman

Re: Motive to Unity

Posted: Mon Dec 01, 2014 11:29 am
by tsvilans

I am also trying to get RigidBody + Marker motions into Unity, however I am directly unpacking the NatNet packet in Unity with C#. I've got it running, however I cannot get frame data from Motive correctly. When I send a model info request (message type 4), I am able to extract all the correct information. However, when I send a frame request (message type 6), Motive returns an 'unknown command' response (message type 100).

I've tried cycling through from 0 to 100 message types. The only ones that return anything are 0 (ping), 2 (generic request?) and 4 (model info request). Everything else returns 100.

I've taken a look at your code (which looks much more cleverly implemented than mine :) ), however your method is different and does not run into this problem. I'd like to avoid any 'middle-men', hence the unpacking directly in Unity, however I would love to get some advice / pointers about how to do this properly...

Re: Motive to Unity

Posted: Mon Dec 01, 2014 4:41 pm
by NaturalPoint-Dustin

I have a member of our dev team reviewing your question right now. We should have a response for you shortly.

Re: Motive to Unity

Posted: Tue Dec 02, 2014 2:35 am
by tsvilans
Thanks, Dustin, really looking forward to it!

Re: Motive to Unity

Posted: Tue Dec 02, 2014 2:55 pm
by NaturalPoint-Dustin
This is a slightly simplified approach but have you looked at the Unity sample within the NatNet samples directory? We recently added this sample. It gives you a very simple approach to communicate data into Unity in a simplified approach and does not require direct depacketization.

The primary up-side is that you can stream whatever information you want into Unity in whatever format you like...binary, XML, etc. and it's very simple. The primary down-side is that you'll have an EXE running in addition to Motive.

Please review this and let us know if it is a possible solution for you.

Best Regards,

Re: Motive to Unity

Posted: Wed Feb 11, 2015 4:22 am
by niccoleo
thanks for this project, very useful.
When I open the scene "sample" of the unity project on the same machine where there is Motive I can receive data, but when I try to stream to another machine I can't receive anything.
what is the order of the ip in UnitySample.exe?
In the tutorial I saw "UnitySample.exe".
which of the two is the server ip? the first? like this "UnitySample.exe SERVERIP CLIENTIP"?
thank you

Re: Motive to Unity

Posted: Thu Feb 12, 2015 4:45 pm
by NaturalPoint-Dustin

I just opened the Unity Sample and confirmed that it is:

UnitySample [ServerIP] [LocalIP]

Best Regards,

Re: Motive to Unity

Posted: Thu Mar 12, 2015 3:50 pm
by BradleyNewman
Here's v2: ... authuser=0
This is still streaming over UDP instead of a direct plugin.

Release Notes

Added ability to override a specific RB origin instead of using the origin assigned to OptitrackRigidBodyManager.

- Added ability to choose whether you want to use positional and/or rotational tracking.

- There was an issue where if you rotated the origin away from the World alignment it didn't correctly rotate all the rigid bodies. Now you can rotate the origin to some orientation other than the World and all RBs will get rotated correctly.
- SlipStream port was being used after running the app once. Fix kills the SlipStream when the application quits so the port is freed up again.

Re: Motive to Unity

Posted: Thu Mar 12, 2015 4:43 pm
by beckdo
That's great Bradly.

We've updated the UnitySample in NatNet so that it streams all rigid bodies and skeletons instead of only skeleton data. This will be a nice update for people wanting to stream rigid bodies to Unity because it won't require an work on their end to modify the UnitySample.


Re: Motive to Unity

Posted: Thu Mar 12, 2015 5:59 pm
by BradleyNewman
Awesome news! Thanks! Any plans for a DLL Unity plugin? Any amount of latency we can shave off for VR would be valuable.