Hello,
Im making an endless runner game, and im trying to get the player to face direction of the location transform while switching lane, i searched and i followed some tutorials but for some reason, it doesnt work on my case, the player start “Shaking” as soon as i switch lane (see video on the link below)
Here is the part of code that is responsible of the rotation
under Update() function :
//rotate player
Vector3 dir = controller.velocity;
if (dir != Vector3.zero)
{
dir.y = 0;
transform.forward = dir;
transform.forward = Vector3.Lerp(transform.forward, dir, TURN_SPEED); // smoother
}
used vars:
private const float TURN_SPEED = 0.05f;
under Start() function
controller = GetComponent<CharacterController>();
And here is a screenshot of the character controller settings :
Thank you,
