C# Camera based Recoil
Hello, I've recently been working on a game in Unity, an FPS (Very original, I know), and am attempting to add in a system by which the camera will rotate up when firing, and smoothly move back to the previous rotation when not shooting.
This is what I'm working with at the moment, any help would be greatly appreciated.
 using UnityEngine;
 using System.Collections;
 
 public class MoveRecoil : MonoBehaviour {
 
     public GameObject PlayerCam;
     public Quaternion startpos;
 
 
     void Start ()
     {
         startpos = PlayerCam.transform.rotation;
     }
 
     // Update is called once per frame
     void Update ()
     {
             
         if (Input.GetKey (KeyCode.Mouse0)) {
             PlayerCam.transform.Rotate (Vector3.right, -.5f);                                                                                                                    
         } 
         else {
             PlayerCam.transform.rotation = Quaternion.Lerp (PlayerCam.transform.rotation, startpos, 0);   
         }
     }
 }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Recoil system 0 Answers
Networking Fps Cameras 0 Answers
Problem of stuttering FPS Camera 1 Answer
I have a problem with making a first person shooter 2 Answers