Hi again. I’m now trying to make my character’s y rot to lerp to the same value as the camera’s y rot. This way the character will face the same direction the Camera is, at least that’s what I expect to happen. This is the code I’m using:
private void RotateToCamFunc()
{
if (IsMoving())
{
float camY = Camera.transform.eulerAngles.y;
float newY = Mathf.Lerp(transform.eulerAngles.y, camY, camBasedPlayerRotationLerp);
transform.eulerAngles = new Vector3(transform.eulerAngles.x, newY, transform.eulerAngles.z);
}
}
Unfortunately, it’s pretty glitchy. The character will just randomly glitch while turning. And when I believe the camera goes from 359 to 0, the Lerp craps itself and does a full 360 degree turn the opposite way.
Any Idea how I could fix this, or a better solution to the problem altogether?