Troubles while making the camera follow the player

I made a new project and copied the game.project file from the Pixel line platformer. I was making almost everything as it was in the example project, adapting somethings to mine and etc. But the problem is that the camera is not following the player. I put the player (a collection) inside this level called tests.collection, at the init() function of the script attached to the player, it activates the camera componnent of the player (the player collection has a componnent called camera that has a camera componnent in it). The componnent called camera has a script that prints its position in world space, and it is always the same as the player is. It shows that the camera should be following the player, but it doesnt.
Rorô.zip (111.7 KB)

It was tried to remove the zoom (and the background color) and it gave this result:

You need to offset the camera by half your display size. The camera position should be in the lower left corner of what you wish to see:

1 Like

it worked, but why is that so?

This is how the camera system is designed. Good or bad, I don’t know. The camera has to have some position and we choose bottom left. Remember that it is not always that you want the camera centered on another object. Sometimes it should be offset from that object, for instance while moving you may want the camera to show more of what is in the direction of movement and less of what is behind you.

There’s also camera solutions such as RenderCam and Orthographic that will handle the positioning of the camera for you while following another game object.

2 Likes