how can I make my player curve while walking in x wAsD ← AD
test my script… please lift me up…
void Update()
{
float horizontalInput = Input.GetAxisRaw("Horizontal");
float verticalInput = Input.GetAxisRaw("Vertical");
Vector3 movementDirection = new Vector3(horizontalInput, 0, verticalInput);
movementDirection.Normalize();
if(movementDirection != Vector3.zero)
{
float targetRotation = Mathf.Atan2(horizontalInput, verticalInput) * Mathf.Rad2Deg + Camera.main.transform.eulerAngles.y;
transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle(transform.eulerAngles.y, targetRotation, ref turnSmoothVelocity, turnSmoothTime);
}
float targetSpeed = speed * movementDirection.magnitude;
currentSpeed = Mathf.SmoothDamp(currentSpeed, targetSpeed, ref speedSmoothVelocity, speedSmoothTime);
transform.Translate(transform.forward * currentSpeed * Time.deltaTime, Space.World);
anim_Warrior(movementDirection);
}