Hi.
I can’t seem to get the check for pin standing to return correctly.
After a few seconds running most of my pins return a false value for the standing check
Debugging Pin 1 is showing a tiltZ value of 359.98 when I’d expect to see -0.02 which would then be an absolute value of 0.02 and would then return true. This is showing in the rotation value of the inspector but isn’t returned by the eulerAngles.
I’m using Unity 2017.3
My code:
public bool IsStanding() {
Vector3 rotationInEuler = transform.rotation.eulerAngles;
float tiltX = Mathf.Abs(rotationInEuler.x);
float tiltZ = Mathf.Abs(rotationInEuler.z);
if (statusDebug) Debug.Log("xtilt: " + tiltX + " ztilt: " + tiltZ);
if (tiltX < standingThreshold && tiltZ < standingThreshold) {
return true;
} else {
return false;
}
}