EXTOSC

       In order to pass the data between phone and PC, I think I will use Open Sound Control(OSC) to do it. There is a convenient assets in  Unity which is extOSC. 

    The tutorial I have is start with FaceOSC(Git), it can track people's face and use it to do many things. Like use movement of face to control the gameobject.   

    First, I install extOSC in my Unity and add a OSC receiver script into a empty gameobject named OSC Manager. It will automatically get your local host IP and local port which is very convenient, save time to find it in the internet setting. The IP address and local port are very important, because if it does not match to your other software, it cannot receive any data from them. 

    Second, once you downloaded the FaceOSC you need to open the setting file and find the port number, then you change the port number in Unity to the number in the FaceOSC setting file.  
   If you want to try it first, you can just open the exe file in the folder, it will use your camera. Then you will see your face and the grid that cover your face, it means FaceOSC is tracking your face now.

    After finish this, you can go back to Unity, click work in Editor and open OSC Console in the Tools bar. You will see a lot bundle which means FaceOSC is connected to your Unity. Important! Make sure you port number is match to the FaceOSC. 
    The thing you need from the OSC console is the orientation data, and 
 just simply copy /pose/orientation  you will need it later. Now add a Vector 3 reflection script into OSC manager and paste /pose/orientation to receiver address. Set OSC Receiver to the receiver that has same port number as well.

    Click the + in the target and create a new cube gameobject or other 3D shape object. Drag it to the thing you just created. You can use it for many different things, you can just click the drop down menu under the target to see it.


    Create a new script for your cube. 
    After you copy the code into script, you can open a new inspector and lock one of the inspector window by click the lock icon , so you can see 1 inspector of Cube and 1 inspector of OSC manager. It will be easier for you to debug. And drag the script to the target and change the member to the vecotr3 rot_0.
    
    Now it should works. 




    I haven't finish the second part of the tutorial that includes how to pass phone data through OSC, I will finish it late of this week.











评论

此博客中的热门博文

Work Plan

My Research

Development Progress