I use the following codes in Update()
to move the character, Runner, a GameObject
:
rigidbody.AddForce(new Vector3 (speed, 0, 0), ForceMode.Acceleration);
I use the following codes in Update()
to change the direction of the Runner GameObject
:
if (Input.GetKey(KeyCode.LeftArrow)) {
Quaternion target = Quaternion.Euler(0, 90, 0);
gameObject.transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * smooth);
}
The Runner can rotate 90degree, but its movement direction does not change. Also, maximum rotation degree is 90degree, why? Did I misunderstand the use of the function Quaternion.Slerp()
?
Also, the Runner still runs at original direction, how to make the Runner change direction ( following the rotation ) ?