Make character centered on camera?

Currently I have a script for the camera following the player, but due to the camera’s angle and field of view, I need to move it back “-54.71” on the z axis for the player to be roughly in the middle of the screen. Although I want to make sure the player is exactly in the middle.

Is there any way to script the camera, so that the player is always in the exact middle? I’ve looked at a bunch of tutorials for making the camera follow the player, but none of them account for camera rotation, so I end up with pretty much the exact same results.

LookAt won’t work, because I want a very specific angle, and LookAt will change the rotation to put the player in the center.

Why You want to script it when You can just set how camera is supposed to look and make it a child of player? Then You could take current camera rotation and just force it to maintain same exact rotation via script so player rotation do not change camera rotation.

Because when using a script, you can create a smoothing effect, so the camera takes a while to speed up, and then to catch up with the player when you stop. You can’t do that by just parenting the player object to the camera.

Not to mention that doing things from script, gives way more freedom and robustness over the control of the camera, rather than making it a child of the player, and allowing the engine to do most of the work. And then having to deal with any quirks or issues that arise from making the camera a child of the player (like having to freeze/force the camera’s rotation). What if I wanted to later rotate my camera while the player was also rotating, but I wanted to rotate the camera separately?

Also, by parenting the player to the camera, I would still have to manually position the camera like I am doing now. And like I said, I want to make sure the player is in the exact center of the camera’s view, which is not possible by manually positioning it.

You could smooth it out with a child, but I agree it would require some extra work to do so.

Well You will have to deal with any issues and quirks of Your scripts, bugs and so on. If You would like to unfreeze it all You would need is just a bool that would release camera from fixed rotation.

Well if You really need to do it automatically You could use raycast from camera, move player to the position and offset him from the ground in Start. Then camera would need to follow player. Problem is I do not know if You have anything that raycast from camera can hit to set camera center.