Hi Guys,
I am having some trouble with lecture “Pins Have Settled 1” in that the Z rotation of the pins seems to be influx.
I have placed the following code into my Pin IsStanding() method. Note I am using Unity 5.5.0f3 and this apparently this doesn’t give back negative eulerAngles. Though when I am inspecting the rotation of the Z axis on a single pin it seems to be quivering and moving. Though I am unsure why this would make the rotation go as high as 70 degress.
public class Pin : MonoBehaviour
{
public float standingThreshold = 3f;
public bool IsStanding()
{
float newX = 270f - transform.rotation.eulerAngles.x;
float tiltX = (newX < 180f) ? newX : 360 - newX;
float tiltZ = (transform.rotation.eulerAngles.z < 180f) ? transform.rotation.eulerAngles.z : 360 - transform.rotation.eulerAngles.z;
if(tiltX > standingThreshold)
{
print("X Failed");
}
if (tiltZ > standingThreshold)
{
print("Z Failed");
}
return (tiltX < standingThreshold && tiltZ < standingThreshold);
}
}