Hey there,
You're going about this the wrong way. Instead of hard-coding your gun to follow the rotation of the camera, all you need to do is parent you gun GameObject to your camera. You can do this by dragging you gun GameObject on top of the camera object in the Hierarchy.
By parenting it, you gun's rotation values will now be made relative to the camera's rotation values, and it will achieve what you're going for. :)
Hope that helps,
Klep
↧