Ejemplo n.º 1
0
    private void MakeMusic()
    {
        float posX = Mathf.Sin(Mathf.Sin(v) * xFactor * Mathf.PI);
        float posY = Mathf.Cos(Mathf.Cos(v) * yFactor * Mathf.PI);
        float posZ = Mathf.Sin(Mathf.Cos(v) * zFactor * Mathf.PI);

        Vector3 pos = new Vector3(posX, posY, posZ);

        //this.transform.position = pos; // steuert die Position im Raum
        rb.AddForce(pos * forcePower); // steuert die Force des Rigidbodys

        Debug.DrawLine(pos, Vector3.zero);

        float speedRemapped = rb.velocity.magnitude.Remap(0, 2f, -1, 1f); // Remap(rb.velocity.magnitude,
        //float formant = rb.velocity.magnitude.Remap(0, 2, 0, 1f);
        float formant = posX.Remap(-1, 1, 0, 1f);
        float filter  = posX.Remap(-1, 1, 0, 1f);

        helmController.SetPitchWheel(speedRemapped);
        helmController.SetParameterValue(AudioHelm.CommonParam.kFormantX, formant);
        helmController.SetParameterValue(AudioHelm.CommonParam.kFormantY, formant);
        helmController.SetParameterPercent(AudioHelm.CommonParam.kFilterCutoff, filter);
    }