Making movement more natural

Hi

I’m new to Unity and I love it, but I have to say that I hate the movement of the first person controller. I dislike that it is so smooth to start moving and also to finish moving, I want it to start moving at maximum speed when I start pressing W and to stop moving immediately after I stop pressing W (to make it seem a bit more natural). Same for sideways and backwards.

I’ve looked through all of the scripts that I could find that related to the first person camera, but I couldn’t find a way of modifying it (from my basic understanding of how Unity scripting works).

Can anyone help me please?

Thanks

1 Answer

1

var speed : float = 6.0;

var jumpSpeed : float = 8.0;

var gravity : float = 20.0;

var rotateSpeed = 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update()
{
var controller : CharacterController = GetComponent(CharacterController);

if (controller.isGrounded)

{

  moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,0);
  moveDirection = transform.TransformDirection(moveDirection);
  moveDirection *= speed;
  var y = Input.GetAxis("Horizontal") * Time.deltaTime * rotateSpeed;
  transform.Rotate(0, y, 0);

  if (Input.GetButton ("Jump"))
  {
     moveDirection.y = jumpSpeed;
  }

}

moveDirection.y -= gravity * Time.deltaTime;

controller.Move(moveDirection * Time.deltaTime);

}

Try this. Put this on the character and then make sure the camera has the mouse look on it.

actually, if you're using a charactercontroller there's still the "sliding" where you gain momentum and lose it again, as far as i remember anyway.

Check this out. This is one of my tutorials. http://www.youtube.com/watch?v=QI_5w4Y2dek