For the life of me I can't figure this one out. I've spent a couple hours messing around with quaternions and euler angles, but haven't managed to make my character face the opposite direction. Here's what I attempted so far:
Quaternion lookAt = Quaternion.Euler(-transform.rotation.eulerAngles);
Quaternion lookAt = Quaternion.Inverse(transform.rotation.eulerAngles);
gameObject.transform.Rotate(new Vector3(0,180,0)Quaternion lookAt = Quaternion.Euler(-transform.localEulerAngles)I thought this would be trivial but apparently not. I don't know whether to use local or world coordinates (I tried both). What happens in most of the cases above is that the amount the character rotates depends on the direction it's facing. transform.Rotate doesn't rotate my character at all. I don't know why this is so difficult and most of the solutions I found online haven't been much help either. Really appreciate any ideas you have. 
ok finally found a solution. Thank you Loius (https://answers.unity.com/questions/446536/reverse-axis-of-quaternion.html)
Apparently you need to multiply quaternions to get an accurate rotation. Don't know why other answers neglected to mention this.
What I ended up doing was lookQuaternion = transform.rotation*Quaternion.AngleAxis(180, Vector3.up);
 to make the character face the opposite direction on the Y Axis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With