|
I want to know how to change an object's rotation on specific axis through script when it touches the ground because I am working on a flight sim. I know how to chage the rotation of it but I don't know how to change rotation for only the X and Z axis but keep the rotation of the Y axis the same. I use this code. function OnCollisionEnter(collision : Collision){ if (collision.gameObject.name == "Terrain"){ transform.rotation = Quaternion.Euler(0,0,0); } }
(comments are locked)
|
Alternatively, if it is a rigidbody, you can lock certain rotations on the rigidbody settings of the object.
(comments are locked)
|
|
Use something like this:
(comments are locked)
|
