I was unable to get proper results using euler angles to determine if a pin is standing up. I have reached another solution.
I compare the local space up vector(expressed in world coordinates) with the world space up vector in order to get the angle betwen this two vectors. Here is the code:
public bool IsStanding() {
//pinAngle is the angle betwen local space up vector and world space up vector
float pinAngle = Vector3.Angle(gameObject.transform.up, Vector3.up);
//standingThreshold is the maximum angle to determine if
//a pin is pointing up enough to consider it standing
if (pinAngle>standignThreshold) {return false;}
return true;
}
At this moment it works perfectly. I can not determine if this method is too much time consuming or not, but for now it works perfectly.