I'm trying to develop an app that can detect car acceleration, braking and cornering speed. I need to detect device acceleration. Is that acceleration high or low?. Like flo app on Google Play.
I'm using gyroscope and I need to get highest value for user acceleration (x, y, z axises) from gyroscope. Values of x, y and z are changing every frame. I need to achieve highest value of this 3 axis for later use.
Now my current code looks like this
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour
{
public Text x, y, z;
void Start()
{
Input.gyro.enabled = true;
}
void Update()
{
x.text = Mathf.Abs(Input.gyro.userAcceleration.x).ToString();
y.text = Mathf.Abs(Input.gyro.userAcceleration.y).ToString();
z.text = Mathf.Abs(Input.gyro.userAcceleration.z).ToString();
}
}
Thanks for any help