12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using static API_GSXR_Slam;
- public class K102ControllerInfo : ControllerInfoBase
- {
- [SerializeField]
- protected TextMeshProUGUI Type;
- [SerializeField]
- protected TextMeshProUGUI Acc;
- [SerializeField]
- protected TextMeshProUGUI Gyro;
- float[] acc = new float[3];
- float[] gyro = new float[3];
- protected new void Start()
- {
- base.Start();
- }
- protected new void Update()
- {
- base.Update();
- ShowAcc();
- }
- private void ShowAcc()
- {
-
- if (is_Left)
- {
- API_GSXR_Slam.plugin.GSXR_Get_ControllerAccelerometer(acc, 0);
- API_GSXR_Slam.plugin.GSXR_Get_ControllerGyroscope(gyro, 0);
- }
- else
- {
- API_GSXR_Slam.plugin.GSXR_Get_ControllerAccelerometer(acc, 1);
- API_GSXR_Slam.plugin.GSXR_Get_ControllerGyroscope(gyro, 1);
- }
- Vector3 speed_1 = new Vector3(acc[0], acc[1], acc[2]);
- Vector3 speed_2 = new Vector3(gyro[0], gyro[1], gyro[2]);
- Acc.text = speed_1.ToString("f3");
- if (speed_1 != Vector3.zero)
- {
- ChangeColor_Green(Acc);
- }
- Gyro.text = speed_2.ToString("f3");
- if (speed_2 != Vector3.zero)
- {
- ChangeColor_Green(Gyro);
- }
- }
- }
|