ozzyonfire / UnityOptitrack

A test project to get Optitrack streaming into Unity 3D without using a .dll
25 stars 8 forks source link

Further instruction #2

Open patrickliu90 opened 10 years ago

patrickliu90 commented 10 years ago

Hi, you still there? I accidentally used another person's account, I was the guy posted the last issue.

I have a Unity 4.5.2 Pro on my computer, and a optitrack system working, with Motive, currently have 9 cameras. We are trying to get transmit the data we get from Motive into Unity, let's say the movement of a single marker, and get feedback from unity. I just loaded the test.scene into unity and get the motive running, and don't know what to do next. I'm really a nube with there things, could you help me a little bit?

Thanks a lot

ozzyonfire commented 10 years ago

First thing you need to do is start streaming rigidbodies in Motive.

  1. Create a rigidbody.
  2. Go to View > Rigidbody Properties
  3. Highlight the markers you want to include in your rigidbody (I think you need at least 3)
  4. Click "Create from Selection"

Now, when streamed, this rigidbody will appear as Index 1.

  1. Start streaming.
  2. Go to View > Data Streaming
  3. Check off Broadcast Frame Data
  4. Make sure "Stream Rigid Bodies" is set to "True"

At this point you should be able to see your rigidbody move around in Unity in the test scene. Actually streaming individual markers is definitely possible, but I think it requires slightly modifying my existing code, since I created the project for streaming rigidbodies.

Let me know if you run into more problems.

patrickliu90 commented 10 years ago

About the

  1. Start Streaming. step, actually how to do that?

I still don't see anything in Unity, just a stationary cube, should it be moving according to rigid body if it's running correctly?

Is there anything we need to do in the Unity side?

patrickliu90 commented 10 years ago

Hi, just got the unity connected to optitrack, many thanks.

I'm doing a project which you may be a bit interested in or experienced with, so here it is:

I want to develop a game with optitrack and oculus combined. Instead of using oculus, mouse and keyboard as inputs, I just want to use optitrack and oculus as inputs, optitrack monitors where you are going and oculus tells you where are you looking at and gives you a stereo vision of the scene.

Maybe you are interested in this, or have an opinion on it?

ozzyonfire commented 10 years ago

Start Streaming was just the title of the step. The following points let you turn it on.

In the unity test.scene make sure Cube has OptiTrackObject script attached and the Rigidbody Index variable is set to 0.

Also, try changing the Scale variable of your optitrack manager. It's possible that the cube is moving, but it's too subtle to notice.

And make sure you are running the scene in Unity ;)

ozzyonfire commented 10 years ago

Sounds awesome! Let me know how it turns out! I would be happy to play/test the game here. We have an Oculus and Optitrack setup at my lab :)

patrickliu90 commented 10 years ago

Hi, have some progress to tell you:)

Right now I created a rigid body on optitrack from several markers placed on my head, streamed the data into unity, imported the oculus camera integration into that and wrote a simple script that make the oculus follow the position of the rigid body. So basically what I can do now is to use optitrack to help oculus find the position of the camera, we don't need mouse or keyboard anymore.

I was wondering have you tried to actually stream a whole skeleton into unity, that will be really cool, I want to create a augment reality design, so you can see your body in the oculus.

Thanks, Chi

patrickliu90 commented 10 years ago

Actually I have a question, can this implementation of yours scream data from optitrack in one machine to another machine with unity?

ozzyonfire commented 10 years ago

Hey, I'm glad things are working! Motive is the application that is actually streaming the points. So In motive you just have to change the IP address to point to your new machine. I think there is also somewhere in unity (in my code) where you have to change the IP address. This has never been tested, but in theory it should work.