|
The script is intended to rotate my Gun on the x angle when I move my mouse horizontal. My script works fine as long MoveOnX is positive, But when its negative, it changes the x, y and z rotation. Can someone help me? GunMovement.js
(comments are locked)
|
|
Can you give some background as to why you are doing this? Could your problem possible be solved by parenting your gun to the players camera?
(comments are locked)
|
|
It looks like a gimbal lock issue. Try setting the gun's .rotation to a Quaternion.Euler instead of directly changing its euler angles. This produces smoother results for me:
(comments are locked)
|

For the record: Use code tags (highlight all the code, block by block, and click the "101010" button) when pasting code. It's much appreciated by both those looking to answer your question, and those who had the same question, and are looking to the answers for guidance.
Did what you said; changes nothing.
Your whitespace and brackets are very funky, which makes it tricky to read. Code should look at least similar to this (there are lots of different "where brackets go" beliefs, but they should line up somehow)
When you have something like
, it can get really tricky to read.