All I want is for my camera to follow smooth, but it keeps following the animation motion which I get:
Video screen shot of the problem
I mostly understand what the problem is but I have tried 100 different solutions with no positive results.
My first thought is to create an avatar parent that houses the children both the player and the camera and then the camera would stay inside. But the parent doesn't move with the child... makes sense.
So I manually matched position through update and late update but then for some reason the whole game object falls through the floor.
So I attached a collider to the parent, and it still falls through. I am using photon so I can't move the rigid body to the parent because photon view requires it.
I have also tried to parent the camera to the root game object hoping there would be no sway... fail!
Even that screencapture is using vector3 Slerp, I have tried lerp but it's linear interpretation so even if it solved it Slerp makes more sense for me.
I have though that maybe if I offset the rotation with negative of the value that might solve it but then if I rotate my character on purpose than I hit a problem.
Although this is only one variation I know that it might help:
/// <summary>
/// puts the camera in the correct location andsets the camera to look at the hero
/// </summary>
public void position_the_camera()
{
//camera.transform.position = player.camera_position.transform.position;
camera.transform.position = Vector3.Slerp(
player.camera_position.transform.position,
player.camera_position.transform.position - camera_offset,
camera_follow_smoothing_time);
camera.transform.LookAt(player.look_at_target.transform);
}