- Home /
How to make the camera rotate up to act as recoil?
I am trying to make my first game in unity, being a FPS. I have all of the controls and am working on animations, but I cannot get recoil working. I am currently running the following script if the player is holding left mouse button down: Camera.main.transform.Rotate( recoil * Time.deltaTime, 0, 0 ) ;
recoil is currently set using float recoil = 10.0f;
. But all this code is doing is jolting the screen slightly, not making the camera slowly travel up. I gave up building this FPS for some time, but after coming back to try and do more work I still cannot get this recoil working. Any help would be greatly appreciated.
Hey maybe you could make a animation where you move the camera, and then just start the animation in the code when the player clicks? :P
Answer by 0V3RR1D3 · May 20, 2015 at 08:33 AM
Set the local x rotation on the camera when the player shoots to say +10 then lerp it back to 0. So it will jump up and smoothly go back to its original angle, :P