soundvision/UnityProject/Assets/Scenes/Examples/MIDI/script/PositionBind.cs
Chikashi Miyama d00d95859f refer #60
2019-10-05 14:18:52 +02:00

22 lines
565 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace cylvester
{
public class PositionBind : MonoBehaviour
{
[SerializeField,Range(1,16)] private int channel = 1;
public void OnControlMessageReceived(ControlMessage mes)
{
if (mes.Channel == channel - 1)
{
var x = (mes.ControlNumber - 64) / 10f;
var y = (mes.ControlValue - 64) / 10f;
transform.position = new Vector3(x, y, 0f);
}
}
}
}