コード例 #1
0
    static void MapIntensity(OscMessage message, Light light, LightData lightdata)
    {
        float val = message.GetFloat(0);

        val = Unicom.Utility.MapValue(val, lightdata.inputRange.x, lightdata.inputRange.y, lightdata.outputRange.x, lightdata.outputRange.y);
        // Mathf.Clamp(val, 0.0f, 1.0f);
        light.intensity = val;
    }
コード例 #2
0
    static void MapColorGradient(OscMessage message, Light light, LightData lightdata)
    {
        float val = message.GetFloat(0);

        val = Unicom.Utility.MapValue(val, lightdata.inputRange.x, lightdata.inputRange.y, lightdata.outputRange.x, lightdata.outputRange.y);
        // Mathf.Clamp(val, 0.0f, 1.0f);
        light.color = lightdata.colorGradient.Evaluate(val);
    }
コード例 #3
0
ファイル: ReceiveAll.cs プロジェクト: 0x16e8bea/FlowerWaltz
    void OnReceive(OscMessage message)
    {
        if (message.address == "/noisiness")
        {
            float data   = message.GetFloat(0);
            float scaled = Mathf.Lerp(0.1f, 4f, data);           // Scale to new range

            noisinessGameObject.transform.localScale = new Vector3(scaled, scaled, scaled);
        }
        else if (message.address == "/brightness")
        {
            float data = message.GetFloat(0);
            Color c    = new Color(data, data, data);

            brightnessGameObject.GetComponent <Renderer>().material.color = c;
        }
    }
コード例 #4
0
ファイル: ReceiveLevel.cs プロジェクト: FabioHEPL/MazeVR
    // Function that receives the message
    void OnReceive(OscMessage message)
    {
        float data = message.GetFloat(0);

        float scaled = Mathf.Lerp(0.1f, 8f, data);       // Scale to new range

        transform.localScale = new Vector3(scaled, scaled, scaled);
    }
コード例 #5
0
 void OnReceiveAcc(OscMessage message)
 {
     for (int i = 0; i < 3; i++)
     {
         accData[i] = message.GetFloat(i);
     }
     lastTimeUpdated = Time.time;
 }
コード例 #6
0
    void OnRotRight(OscMessage message)
    {
        float x        = message.GetFloat(0);
        float rotation = x * Time.deltaTime;

        playerBody.Rotate(Vector3.up * rotation);
        Debug.Log("osc update, received rotright: " + x);
    }
コード例 #7
0
    void onReceiveScale(OscMessage message)
    {
        rawScale = message.GetFloat(0);

        //make this code smarter
        //to determine if it's actually been receiving data for a while
        isReceiving = true;
    }
コード例 #8
0
ファイル: OscReceiver.cs プロジェクト: skagla/Particles
    public void OnReceive(OscMessage message)
    {
        if (showMsg)
        {
            Debug.Log("osc: " + message.address + ", " + message.GetFloat(0));
        }

        input  = message.GetFloat(0);
        output = MapParameter(input);
        if (clamp)
        {
            output = Mathf.Clamp(output, outputMin, outputMax);
        }
        if (isActive)
        {
            visualEffect.SetFloat(vfxParameterName, output);
        }
    }
コード例 #9
0
    void OnReceiveEnd(OscMessage message)
    {
        float endStatus = message.GetFloat(0);

        if (endStatus == 1)
        {
            sceneManagement.StopProject();
        }
    }
コード例 #10
0
    public void RecibirNumPeople(OscMessage m)
    {
        float num0 = m.GetFloat(0);

        Debug.Log("Tiempo: " + num0);
        float num1 = m.GetFloat(1);

        Debug.Log("Porcentaje: " + num1);
        float num2 = m.GetFloat(2);

        Debug.Log("Persons: " + num2);
        float num3 = m.GetFloat(3);

        Debug.Log("average x: " + num3);
        float num4 = m.GetFloat(4);

        Debug.Log("average y: " + num4);
    }
コード例 #11
0
    void OnReceiveCleanser(OscMessage message)
    {
        float state = message.GetFloat(0);

        if (state == 1)
        {
            Bees.burst("FlyingBlue");
            Count10Sec++;
        }
    }
コード例 #12
0
    void OnReceiveHex(OscMessage message)
    {
        float state = message.GetFloat(0);

        if (state == 1)
        {
            Bees.burst("Walking");
            Count10Sec++;
        }
    }
コード例 #13
0
    void OnReceiveEEG(OscMessage message)
    {
        for (int i = 0; i < 4; i++)
        {
            eegData[currBufferPositionEEG % bufferSize][i] = message.GetFloat(i);
        }
        currBufferPositionEEG++;

        lastTimeUpdated = Time.time;
    }
コード例 #14
0
    void GetAbsoluteBandPower(OscMessage m, ref BrainWave brainWave)
    {
        // get band powers
        float[] floats =
        {
            m.GetFloat(0),
            m.GetFloat(1),
            m.GetFloat(2),
            m.GetFloat(3)
        };

        // set band power
        float averageBandPower = Average(floats);

        brainWave.AbsoluteBandPower = averageBandPower;

        // record band power
        brainWave.RecordAbsoluteBandPower(averageBandPower);
    }
コード例 #15
0
    void OnBackward(OscMessage message)
    {
        float z = message.GetFloat(0);

        Debug.Log("osc update, received backward: " + z);

        Vector3 move = transform.forward * -z;

        controller.Move(move * Time.deltaTime);
    }
コード例 #16
0
    void OnReceiveZ(OscMessage message)
    {
        float z = message.GetFloat(0);

        Vector3 position = transform.position;

        position.z = z;

        transform.position = position;
    }
コード例 #17
0
    void OnReceiveX(OscMessage message)
    {
        float x = message.GetFloat(0);

        Vector3 position = transform.position;

        position.x = x;

        transform.position = position;
    }
コード例 #18
0
    void OnReceiveY(OscMessage message)
    {
        float y = message.GetFloat(0);

        Vector3 position = transform.position;

        position.y = y;

        transform.position = position;
    }
コード例 #19
0
    void OnReceiveZ(OscMessage message)
    {
        float z = message.GetFloat(0);

        valorVector = transform.position;

        valorVector.z = z;

        transform.position = valorVector;
    }
コード例 #20
0
    void PlaneFunc(OscMessage msg)
    {
        int   x      = msg.GetInt(0);
        int   y      = msg.GetInt(1);
        int   z      = msg.GetInt(2);
        float degree = msg.GetInt(3);
        float amp    = msg.GetFloat(4) * scaleAmp;

        clones[x + (y * numX)].localScale = new Vector3(amp, amp, amp);
    }
コード例 #21
0
/*	void OnReceiveX (OscMessage message)
 *      {
 *              float x = message.GetFloat (0);
 *
 *              valorVector = transform.position;
 *
 *              valorVector.x = x;
 *
 *              transform.position = valorVector;
 *
 *      }
 */
    void OnReceiveY(OscMessage message)
    {
        float y = message.GetFloat(0);

        valorVector = transform.position;

        valorVector.y = y;

        transform.position = valorVector;
    }
コード例 #22
0
        public override void ToOSCDataHandler(OscMessage message)
        {
            float ax = message.GetFloat(0);
            float ay = message.GetFloat(1);
            float az = message.GetFloat(2);
            float gx = message.GetFloat(3);
            float gy = message.GetFloat(4);
            float gz = message.GetFloat(5);
            float mx = message.GetFloat(6);
            float my = message.GetFloat(7);
            float mz = message.GetFloat(8);

            accelerometer = new Vector3(ax, ay, az);
            gyroscope     = new Vector3(gx, gy, gz);
            magnetometer  = new Vector3(mx, my, mz);
        }
コード例 #23
0
    void OnReceiveZ(OscMessage message)
    {
        float z = message.GetFloat(0);

        print("valorZ_______" + z);

        valorVector.z = map(z, -70, 70, -25, 25);

        transform.localPosition = valorVector;
        print(valorVector.z);
    }
コード例 #24
0
ファイル: OscReceiver.cs プロジェクト: skagla/Particles
 void OnReceiveAll(OscMessage message)
 {
     // var values = message.values; values.Count
     // output = message. ToFloat();
     // output = "" + message.GetString(0);
     //output = "" + message.GetFloat(0);
     //output = message.values.; inputs[i] = message.GetFloat(i);
     // onOSCReceivedFloat.Invoke(message.GetFloat(0));
     if (showAllMsgs)
     {
         print("osc: " + message.address + ", " + message.GetFloat(0)); //+ ", " + message.values
     }
     if (showMyPrefixMsgs)
     {
         if (message.address.Contains(prefix + "/"))
         {
             print("osc: " + message.address + ", " + message.GetFloat(0)); //+ ", " + message.values
         }
     }
 }
コード例 #25
0
ファイル: OSCReceiver.cs プロジェクト: ssun83/VRViewFinder
    void OnReceiveY(OscMessage message)
    {
        float y = message.GetFloat(0);

        Vector3 position = transform.position;

        position.y = y;

        transform.position = originalCam + position;
        Debug.Log(y);
    }
コード例 #26
0
    void OnReceiveHandStatusLeft(OscMessage message)
    {
        ObjectGrabberControllerLeft ogc;
        float handStatus = message.GetFloat(0);

        if (IsObjectGrabberLeftSet(out ogc))
        {
            ogc.setGrabState(handStatus == 1);
            cursorTransformLeft.gameObject.GetComponent <Image>().enabled = handStatus == 0 || ogc.currentSelectedObject == null;
        }
    }
コード例 #27
0
    //Recordar que esto hay que modificarlo!__K
    void OnReceiveX(OscMessage message)
    {
        float x = message.GetFloat(0);

        //valorVector = transform.position;

        valorVector.x = x;

        transform.position = valorVector;
        print(valorVector);
    }
コード例 #28
0
    void OnReceiveX(OscMessage message)
    {
        Debug.Log("Received X !");
        float x = message.GetFloat(0);

        Vector3 position = transform.position;

        position.x = x;

        transform.position = position;
    }
コード例 #29
0
ファイル: OSCReceiver.cs プロジェクト: ssun83/VRViewFinder
    void OnReceiveZ(OscMessage message)
    {
        float z = message.GetFloat(0);

        Vector3 position = transform.position;

        position.z = z;

        transform.position = originalCam + position;
        Debug.Log(z);
    }
コード例 #30
0
    void OnReceiveY(OscMessage message)
    {
        float y = message.GetFloat(0);

        print("valorY_______" + y);

        valorVector.y = map(y, 90, -90, -10, 10);

        transform.localPosition = valorVector;
        print(valorVector.y);
    }