The object is incorrectly flipped.
When it reaches 90 degrees, the object turns over.
But if you knock it down, it flips wrong
Code
public bool FaceRight;
void Start()
{
FaceRight = true;
}
private void FixedUpdate()
{
MouseTracking();
if (transform.localEulerAngles.z > 90 && FaceRight)
{
Debug.Log("Flip");
Vector3 theScale = transform.localScale;
theScale.y *= -1;
transform.localScale = theScale;
FaceRight = false;
}
else if (transform.localEulerAngles.z < 90 && !FaceRight)
{
Debug.Log("Flip");
Vector3 theScale = transform.localScale;
theScale.y *=-1;
transform.localScale = theScale;
FaceRight = true;
}
}
flip.png
(13.6 kB)
ezgifcom-video-to-gif.gif
(420.0 kB)
Comment