Exemple #1
0
 // Use this for initialization
 void Start()
 {
     tags       = new List <MMTag>();
     osc_server = new OSCServer(9000);
     osc_server.PacketReceivedEvent += OnPacketReceived;
     osc_server.Connect();
 }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        server = new OSCServer(port);
        server.PacketReceivedEvent += packetReceived;
        server.Connect();

        controllables = FindObjectsOfType <OSCControllable>();
    }
        // Use this for initialization
        void Awake()
        {
            data = new object[numValues];

            server = new OSCServer(listenPort);
            server.SleepMilliseconds = 1;
            server.Connect();

            server.PacketReceivedEvent += PacketReceived;
        }
Exemple #4
0
    // Use this for initialization
    void Awake()
    {
        server = new OSCServer(port);
        server.PacketReceivedEvent += packetReceived;
        server.Connect();

        controllables = FindObjectsOfType <OSCControllable>();
        foreach (OSCControllable c in controllables)
        {
            Debug.Log("Add controllable : " + c.oscName);
        }
    }
Exemple #5
0
        // Use this for initialization
        void Start()
        {
            if (instance != null)
            {
                Debug.LogError("There are two OptiTrackOSCClients, remove one");
            }
            instance = this;

            mTransform            = transform;
            server                = new OSCServer(oscReceivePort);
            mTransform.localScale = Vector2.one * scale;

            //playerObject.name = playerObjectName;

            server.SleepMilliseconds = 1;
            server.Connect();
            server.PacketReceivedEvent += PacketReceived;
        }
Exemple #6
0
    public void Connect()
    {
        Debug.Log("Connecting to port " + localPort);
        try
        {
            if (server != null)
            {
                server.Close();
            }

            server = new OSCServer(localPort);
            server.PacketReceivedEvent += packetReceived;

            server.Connect();
            isConnected = true;
        }
        catch (Exception)
        {
            Debug.Log("Error with port " + localPort);
            isConnected = false;
        }
    }
Exemple #7
0
    // Start is called before the first frame update
    void Start()
    {
        _quaternionStack = new ConcurrentStack <Quaternion>();

        Application.targetFrameRate = 60;

        _oscServer = new OSCServer(7003);
        _oscServer.PacketReceivedEvent += (s, packet) => {
            Debug.Log($"received OSC {packet.Address}");

            Loom.QueueOnMainThread(() => {
                var controllerTransform = controllersContainer.Find(packet.Address.Replace("/", ""));

                if (controllerTransform != null)
                {
                    // json approach
                    var str       = packet.Data[0] as string;
                    var timestamp = (long)packet.Data[1];

                    var trackingData = JsonConvert.DeserializeObject <GearVRControllerTrackingData>(str);


                    _lastAvailableQuaternion = new Quaternion(
                        trackingData.quaternion[0],
                        trackingData.quaternion[1],
                        trackingData.quaternion[2],
                        trackingData.quaternion[3]
                        );

                    controllerTransform.localRotation = _zeroQuaternion * _lastAvailableQuaternion;
                }
            });
        };

        _oscServer.Connect();
    }
Exemple #8
0
 // Start is called before the first frame update
 void Start()
 {
     _oscServer = new OSCServer(12000);
     _oscServer.PacketReceivedEvent += OscServerOnPacketReceivedEvent;
     _oscServer.Connect();
 }