mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-12 22:44:35 +01:00
33 lines
613 B
C#
33 lines
613 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace MoleMole
|
|
{
|
|
public class TestGyroUI : MonoBehaviour
|
|
{
|
|
private Gyroscope _gyro;
|
|
|
|
public Text gravityText;
|
|
|
|
public Text rotationRateText;
|
|
|
|
public Text attitudeText;
|
|
|
|
public void Start()
|
|
{
|
|
_gyro = Input.gyro;
|
|
_gyro.enabled = GraphicsSettingData.IsEnableGyroscope();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (_gyro != null)
|
|
{
|
|
gravityText.text = _gyro.gravity.ToString();
|
|
rotationRateText.text = _gyro.rotationRate.ToString();
|
|
attitudeText.text = _gyro.attitude.ToString() + "\n" + _gyro.attitude.eulerAngles.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|