Question by
iicow_dudeii · Nov 19, 2015 at 11:17 PM ·
character movement
character continues to move after the buttons are released.
I am trying to make a simpler version of the fps controller script. I have may character moving and looking around but when i release the keys he walks like a square(the squares on the prototype floor) more before stopping. is there any way to fix this so he stops immediately after the keys are released?
here is my script:
public class move : MonoBehaviour {
public float walkspeed = 50;
public float rotspeed = 100;
public Camera cam;
public CharacterController cc;
// Use this for initialization
void Start ()
{
cc = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update ()
{
float fwrd = Input.GetAxis("Vertical");
float strafe = Input.GetAxis("Horizontal");
float turn = Input.GetAxis("Mouse X") * rotspeed;
float turn2 = Input.GetAxis("Mouse Y") * -rotspeed;
var move = transform.TransformDirection(strafe, 0, fwrd).normalized*walkspeed;
cc.SimpleMove(move);
transform.Rotate(0, turn, 0);
//this lets the camera look up and down
cam.transform.Rotate(turn2, 0, 0);
}
}
Comment
Best Answer
Answer by Dinosaurs · Nov 19, 2015 at 11:25 PM
I'm guessing your Gravity on the movement input axes is probably set too low, try turning it up to 1000 or so.
Thanks man I didn't even know that was apart of the inputs
Your answer