Need help converting js to C# - rigidbody.rotation.z

Hi!

Need help to convert js line to C#:

rigidbody.rotation.z = 0;

Hey, the problem is that you can’t modify a single axis directly. Try doing this instead:

Vector3 r = rigidbody.rotation.eulerAngles;
rigidbody.rotation = Quaternion.Euler(new Vector3(r.x,r.y,0));

The reason I’m converting to euler angles is simply because Quartonians are dangerous to modify lol.