Hello, Unityrs,
I am working in writing down very simple script for very basic functionalities. Just to learn Unity. So, now I am committed to understand why my camera/carachterController movements are that slow. I created a prefab and attached a cylinder representing my character, then I attached a characterController component to the prefab and I wrote the following script attached to the prefab. But the movements are very slow..., THANK for any help/suggestion.
private var controller :CharacterController; controller = gameObject.GetComponent(CharacterController);
private var moveDirection = Vector3.zero; private var forward = Vector3.zero; private var right = Vector3.zero; var speed = 0.30;
function Update() { /* var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed; var z = Input.GetAxis("Vertical") * Time.deltaTime * speed; transform.Translate(x, 0, z); */
forward = transform.forward; right = Vector3(forward.z, 0, -forward.x);
var horizontalInput = Input.GetAxisRaw("Horizontal");
var verticalInput = Input.GetAxisRaw("Vertical");
var targetDirection = horizontalInput * right + verticalInput * forward;
moveDirection = Vector3.RotateTowards(moveDirection, targetDirection, 200 * Mathf.Deg2Rad * Time.deltaTime, 1000);
var movement = moveDirection * Time.deltaTime * 2;
controller.Move(movement);
}
