Im using a CharacterController. Here is the movement script which works.
if (controller.isGrounded) {
moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
moveDirection = transform.TransformDirection (moveDirection);
moveDirection *= speed;
if (Input.GetButton ("Jump"))
moveDirection.y = jumpSpeed;
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move (moveDirection * Time.deltaTime);
Questions:
How could i prevent it from going twice the speed when moving diagonally? I know its supposed to be with Vector3.Normalize(), but when i try it just makes everything go very slow whatever i declare speed to be.
Id like the shape model of the player to face the direction it is moving. I could read the keys and just rotate it 90 degrees if its moving to the right and so on, but id like it to be exact direction and dont know how to convert the speed direction to angles.
Im new to using characterController. I cant figure out how i could get slower acceleration, set max speed, and then have a slower decelaration.
Thanks but i dont understand what to do with the line 5. Where should rot go?
– Lautaro-Arino"Id like the shape model of the player to face the direction it is moving" rot will give you that rotation objectThatNeedRotation.transform.rotation = rot;
– prof