Hello guys, I need your help as I am becoming crazy!
I am developing a top-down game and I have a 3D particle that I am using as my sight/crosshair for the gun.
I would need to change the rotation value of X according to the aim of the character without changing the Y and Z axis.
So if my character is looking down it will be (180, 90, -90) and if it is looking right it will be (90, 90, -90) and so on.
I don’t know why is becoming so difficult to archive it…
Thank you in advance!
Unity documentation on rotation:
If you are having issues, you can also edit the rigidbody so that it is only allowed to rotate on certain axes.
1.Make sure your object has a Rigidbody. You can add one by clicking Add Component → Rigidbody. You DO NOT want a Rigidbody 2D because you are using a 3D object.
2.There is a little arrow by the word “Constraints”. Click on it to expand the drop-down menu.
3.Under “Freeze Rotation”, check “Y” and “Z”
4.Oh, also make sure you have gravity turned off or the gun will fall down. On the Rigidbody, Uncheck the box by “Use Gravity”
Hope this helps!