Giter Site home page Giter Site logo

motivedirect's Introduction

Direct Unity C# client for Optitrack Motive

This is a NatNet direct client running in Unity written in C# that allows you to receive tracking data sent from the OptiTrack Motive software directly without intermidiate NatNet SDK server or plug-in. Mostly rewritten from PacketClient.cpp in NatNet SDK and Optirx.

If you just want to see your tracked object appears in Unity, use this. If you want to reduce the tracking network load, use this.

Configuration

Motive Configuration

Unity Configuration


New to Optitrack / Motive ?

Here are good references for you.

Optitrack Quick start Guide

Optitrack Data streaming

Check NatNet Version

[Check your NatNet Version] (https://www.optitrack.com/downloads/developer-tools.html#natnet-sdk)


Features

  • supported Motive 1.0 to 1.9 (NatNet 2.0 to 2.9)
  • separated command thread for sending commands and receiving responses from Motive
  • separated data thread for receiving tracking data
  • a tracking data buffer for keeping historical tracks
  • store mappings of unreadable ID to readable names
  • switch on/off for displaying debug cubes
  • the gameobject in Unity is tagged "tracked" if the object can be recognized by Motive. otherwise it is tagged "untracked".

Setup from Empty project

  • Make an empty object in Unity and attach MotiveDirect.cs to it (as shwon in Configuration).
  • Make sure you add "tracked" and "untracked" to your Tags in Unity.

Usage

There are two easier ways to move your 3D model/gameobject.

  1. Use Gameobject.Find([name]) and let your 3D model/gameobject follows it.
  2. Name your 3D model/gameobject as the same name as the rigidbody in Motive. The system then will move your 3D model/gameobject instead of creating a new one.

License

This project is licensed under the terms of the MIT license.

motivedirect's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

motivedirect's Issues

example of sending a NatNet request

I'm trying to send NatNet requests such as "StartRecording" but I'm getting 'unrecognized request' errors.

Here's my naive code, I've also tried sending the packet directly without Marshal.Copy

private void _send_start_recording(){ if(mCommandListner != null){ PACKET_FORMAT packet = new PACKET_FORMAT(); //NAT_REQUEST //. packet.header.iMessage = NAT_REQUEST;//; packet.header.nDataBytes = 14; string command = "StartRecording"; byte[] msg = Encoding.ASCII.GetBytes(command); packet.payload = msg; IntPtr ptr = Marshal.AllocHGlobal(4); Marshal.StructureToPtr(packet, ptr, true); Marshal.Copy(ptr, msg, 0,4); mCommandListner.SendTo(msg, mRemoteIpEndPoint); Marshal.FreeHGlobal(ptr); } }

any pointers much appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.