void Update() { if (arduinoSerial.ReadInput("val") == null) { return; } float value = float.Parse(arduinoSerial.ReadInput("val"), CultureInfo.InvariantCulture.NumberFormat); //go.transform.rotation = Quaternion.RotateTowards(go.transform.rotation, // Quaternion.Euler( startRot.eulerAngles.x, startRot.eulerAngles.y, value / 600f * 360f ), Time.deltaTime * 500); go.transform.rotation = Quaternion.Euler(startRot.eulerAngles.x, startRot.eulerAngles.y, value / 600f * 360f); }
void Update() { if (arduinoSerial.ReadInput("rawx") == null) { return; } float rawx = float.Parse(arduinoSerial.ReadInput("rawx"), CultureInfo.InvariantCulture.NumberFormat); float rawy = float.Parse(arduinoSerial.ReadInput("rawy"), CultureInfo.InvariantCulture.NumberFormat); float rawz = float.Parse(arduinoSerial.ReadInput("rawz"), CultureInfo.InvariantCulture.NumberFormat); Debug.Log("rawx: " + rawx); Debug.Log("rawy: " + rawy); Debug.Log("rawz: " + rawz); float raz = Mathf.Atan2(-rawy, rawx); float rax = Mathf.Atan2(-rawy, rawz); go.transform.rotation = Quaternion.RotateTowards(go.transform.rotation, Quaternion.Euler((rax * 180 / Mathf.PI) - 90, 0f, -((raz * 180 / Mathf.PI) - 90)), Time.deltaTime * 500); }
void Update() { Debug.Log("someInt: " + arduinoSerial.ReadInput("someInt")); Debug.Log("someFloat: " + arduinoSerial.ReadInput("someFloat")); Debug.Log("someString: " + arduinoSerial.ReadInput("someString")); }