void Start() { myOsc = GetComponent <Oscillator>(); mySynthControl = GetComponent <SynthControl>(); //RightControllerParticleSystem = GameObject.Find("RightControllerParticleSystem"); particles = RightControllerParticleSystem.GetComponent <ParticleSystem>(); }
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)); }
void SetPan(Collider col, SynthControl sc) { float xPos = GetLocalXPosition(col); sc.SetPan(Mathf.Lerp(-1f, 1f, xPos)); }
void SetCutoffFreq(Collider col, SynthControl sc) { float xPos = GetLocalXPosition(col); sc.SetCutoff(Mathf.Lerp(500f, 15000f, xPos)); }