I have a First person controller with a gun as a child. When the FPS looks left or right, the gun moves with it so the gun is pointing in the direction the FPS is looking.
Now, when the FPS looks up or down , I want the gun to rotate forward or back (to simulate the FPS looking down the sights of the gun). What FPS or Camera event can I tap into to achieve this?
Hi,
Not sure to understand what you want here but let me try anyway ^^
Check for the vectical axis input (Unity - Scripting API: Input.GetAxis) and then modify localEulerAngle of your gun with something like:
float rotationValue = Input.GetAxis("Vertical") * speed;
not sure what you mean but if you attach the child object to the FirstPersonCharacter and not to the FPSController, the child object will move on the y-axis too.