コード例 #1
0
 IEnumerator Deactivate(object[] parms)
 {
     while (Time.time < (float)parms[0] + (float)parms[1])
     {
         yield return(null);
     }
     gameObject.SetActive(false);
     OscMaster.SendData("/source/stop " + indexNum); //here we tell maxmsp to turn off the sound
 }
コード例 #2
0
    void Update()
    {
        var data = OscMaster.GetData("/audio/loud");

        if (data != null)
        {
            var loud = (float)data[0];
            transform.localScale = Vector3.one * loud;
            Debug.Log(loud);
        }
        OscMaster.SendData("/test/test 1");
    }
コード例 #3
0
 // Update is called once per frame
 void Update()
 {
     pos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
     rot = gameObject.transform.rotation.eulerAngles;
     if ((pos != lastPos || rot != lastRot) && Time.frameCount % 3 == 0)
     {
         //rot.x = pitch
         //rot.y = yaw
         //rot.z = roll
         OscMaster.SendData("/listener/position " + pos.x + " " + pos.y + " " + pos.z + " " + rot.z + " " + rot.x + " " + rot.y);
     }
     lastPos = pos;
     lastRot = rot;
 }
コード例 #4
0
 public void Launch()
 {
     rb                 = GetComponent <Rigidbody>();
     rb.velocity        = Vector3.zero;
     rb.angularVelocity = Vector3.zero;
     // orbitCenter = GameObject.Find("Camera (eye)");
     print(indexNum);
     direction = orbitCenter.transform.position - gameObject.transform.position;
     initialTangent.Normalize();
     binormal = Vector3.Cross(initialTangent, direction);
     rb.AddForce(gameObject.transform.forward * 1000);
     object[] parms = new object[2] {
         10f, Time.time
     };
     StartCoroutine("Deactivate", parms);
     OscMaster.SendData("/source/start " + indexNum);
 }
コード例 #5
0
    void FixedUpdate()
    {
        if (gameObject.activeSelf)
        {
            direction = orbitCenter.transform.position - gameObject.transform.position;
            rb.AddForce(direction);

            Vector3 tangentForce = Vector3.Cross(direction, binormal);
            rb.AddForce(tangentForce * 100f);
            pos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
            if (pos != lastPos && Time.frameCount % 3 == 0)
            {
                OscMaster.SendData("/source/position " + indexNum + " " + pos.x + " " + pos.y + " " + pos.z);
            }
            lastPos = pos;
        }
    }
コード例 #6
0
    // Update is called once per frame
    void FixedUpdate()
    {
        direction = orbitCenter.transform.position - transform.position;
        //direction.Normalize();
        rb.AddForce(direction);

        Vector3 tangentForce = Vector3.Cross(direction, binormal);

        rb.AddForce(tangentForce * 30f);
        pos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
        if (pos != lastPos)
        {
            OscMaster.SendData("/" + route + "/x " + pos.x);
            OscMaster.SendData("/" + route + "/y " + pos.y);
            OscMaster.SendData("/" + route + "/z " + pos.z);
        }
        trail = lastPos - pos;
        trail.Normalize();
        trail = trail * 10f;
        spray1.initialVelocity = trail;
        spray2.initialVelocity = trail;

        lastPos = pos;
    }
コード例 #7
0
 void OnDestroy()
 {
     OscMaster.SendData("/" + route + "/off 1");
 }