void Start()
 {
     myOsc          = GetComponent <Oscillator>();
     mySynthControl = GetComponent <SynthControl>();
     //RightControllerParticleSystem = GameObject.Find("RightControllerParticleSystem");
     particles = RightControllerParticleSystem.GetComponent <ParticleSystem>();
 }
Beispiel #2
0
    void SetVolume(Collider col, SynthControl sc)
    {
        Vector3 colPos = col.gameObject.transform.position;
        //determine where collider is within the box from
        float distFromBack     = colPos.z - back;
        float localPosZ        = distFromBack / gameObject.transform.localScale.z;
        float clampedLocalPosZ = Mathf.Clamp(localPosZ, 0, 1f);
        // ease out value with Sin, so it gets louder earlier when increasing local Z position
        float t = Mathf.Sin(clampedLocalPosZ * Mathf.PI * 0.5f);

        sc.SetVolume(Mathf.SmoothStep(-80f, 0f, t));
    }
Beispiel #3
0
    void SetPan(Collider col, SynthControl sc)
    {
        float xPos = GetLocalXPosition(col);

        sc.SetPan(Mathf.Lerp(-1f, 1f, xPos));
    }
Beispiel #4
0
    void SetCutoffFreq(Collider col, SynthControl sc)
    {
        float xPos = GetLocalXPosition(col);

        sc.SetCutoff(Mathf.Lerp(500f, 15000f, xPos));
    }