Once a rigidbody turns around a path 180 degrees, I want it to straighten it’s wheels. How do I check the rotation of my rigidbody? I know it’s with rigibody.rotation, but Quaternions are involved and I just don’t understand that stuff.
Anyone able to help?
Thanks,
Fred
Use:
transform.eulerAngles
Euler angles are the degrees you are referring to. Examples:
If you need an object at 180 degrees around the world’s Y axis:
transform.eulerAngles = new Vector3(0,180,0);
If you need an object at 180 degrees around the local transform’s Y axis:
transform.localEulerAngles = new Vector3(0,180,0);
And:
if ( transform.eulerAngles.y >= 180 )
StraightenWheel()
Looks perfect! Thanks a lot! I’ll report back with my findings.