Hello, I watched a tutorial on how to move my character, along with some rotation pointing the direction of the player. Even though it works, I don’t understand how is it moving from right to left, or forward to backwards even though there is no input multiplying the final vector. Any tips on how I can understand it better could help a lot, or some explanation, thanks!
private void Movement()
{
Vector3 move = new Vector3(HorizontalInput(), 0, ForwardInput());
float targetAngle = Mathf.Atan2(move.x, move.z) * Mathf.Rad2Deg + camRef.eulerAngles.y;
float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSpeed);
transform.rotation = Quaternion.Euler(0f, angle, 0f);
Vector3 moveDirection = transform.rotation * Vector3.forward;
charController.Move(Time.deltaTime * SpeedCheck() * moveDirection);
}
HorizontalInput() and ForwardInput() are methods that return their inputs.