Hey y’all, so I am trying to make a platform tilt with gyroscope controls. When I load the game the platform is already tilted as my program seems to create a constant torque based on my phone’s physical location relative to the y axis. I need to be able to set my phones returned location to (0,0,0) or create a torque that can oppose the constant movement of the phone so that these controls are more manageable. Any ideas?
public class balance : MonoBehaviour {
public float torque;
public Rigidbody rb;
void Start() {
rb = GetComponent<Rigidbody>();
}
void FixedUpdate() {
Input.gyro.enabled = true;
rb.transform.Rotate(Input.gyro.attitude.x, 0, Input.gyro.attitude.z);
}
}