title: Unity bouncing when colliding with object
body: <p>I have made a script with movement, that finally works as i want it to, except one thing... I want it to be a first person game, but the way the movement works now, is on the global axis, which means that W is always torwards one specific direction, no matter what direction my camera is turning... How do i fix this? i want the movement to stay how it is, but with the W key to always be forward depending on the way the camera or player is looking.</p>
  
  <p>Please let me know how my script would look edited, or atleast what part i have to change. </p>
  
  <p>I would also like to add that i would love to be able to do a wall jump, but i am not sure how to add that behavior.</p>
  
  <p>Here is my movement script:</p>
  
  <pre><code>public class MovementScript : MonoBehaviour {
  
      public float speed;
      public float jumpforce;
      public float gravity = 25;
  
      private Vector3 moveVector;
      private Vector3 lastMove;
      private float verticalVelocity;
      private CharacterController controller;
  
      // Use this for initialization
      void Start () {
          controller = GetComponent&lt;CharacterController&gt; ();
  
          //Låser og gemmer musen
          Cursor.lockState = CursorLockMode.Locked;
      }
  
      // Update is called once per frame
      void Update () {
          //Låser musen op
          if (Input.GetKeyDown ("escape"))
              Cursor.lockState = CursorLockMode.None;
  
          moveVector = Vector3.zero;
          moveVector.x = Input.GetAxis("Horizontal");
          moveVector.z = Input.GetAxis("Vertical");
  
          if (controller.isGrounded) {
              verticalVelocity = -1;
  
              if (Input.GetButton("Jump")) {
                  verticalVelocity = jumpforce;
              }
  
          } else {
              verticalVelocity -= gravity * Time.deltaTime;
              moveVector = lastMove;
          }
  
          moveVector.y = 0;
          moveVector.Normalize ();
          moveVector *= speed;
          moveVector.y = verticalVelocity;
  
          controller.Move (moveVector * Time.deltaTime);
          lastMove = moveVector;
      }
  }
  </code></pre>