Orthographic camera cuts off my map

I’ve added an orthographic camera, that follows my player. However, it cuts off the bottom section of my map.

This is what the collection looks like compared to the actual gameplay window. I’ve tried following the camera manual but frankly, it isn’t easy to understand, and i’ve also tried moving the camera, but that results in the player then not being followed.

I have tried adding a script to the camera, but wasn’t really sure of what to add, as none of the tutorials seemed to have the issue i’m facing.

The only issue i can think of is it being due to where the camera is anchored, however i’m unsure of where to edit the anchor (if this is possible)

I was also wondering if it’s possible to have it so the player is more centred, rather than being in the bottom left, but this isn’t as important.

The camera should center on the game object it is added to if the camera has focus and uses an orthographic projection.

  1. Add the camera component to your player game object
  2. Make sure to check the Orthographic Projection checkbox
  3. From your player.script (or some other script) acquire camera focus:
function init(self)
    -- enable the camera
    msg.post("#mycamera", "acquire_camera_focus")
    -- tell the render script to use the view projection from the camera
    msg.post("@render:", "use_camera_projection")

That should be it. The camera should follow the player and center on the player.

So, i’ve tried using your code, however my player is now invisible.
This also seems to occur, changing the ortho zoom seems to help, but results in another issue of the map being cut off

pre orthographic zoom change:

post ortho zoom change:

Note that the camera has a near and far z value (-1 to 1). Any visual component which falls outside of this range will not be rendered. Your sprite is probably outside of the range. Increase the range and try again.

Thanks, my player is back now. However, I’m still facing the issue that there is a black screen around my level, I’m wondering if this could be fixed by adding another camera that focuses solely on the map, or if i need to make changes to the render script.

Well, if the level is not large enough to expand beyond the view of the camera you will see whatever you have as clear color (in this case black)

Is there not a way to ‘anchor’ to map to the window size? (ive tried changing the width/height) so that the map stays the size of the window without any cut-off, but still keeping the camera following the player. Or is it a case of having to make it so the level does not cut off by remaking the level. I was wondering if there’s anything in the render script that could be changed, as i noticed there was some code about height/width

I also noticed on an older forum that part of the camera properties includes a follow box that can allow you to choose the follow target, however i cant find this, im assuming this has changed w/updates as the forum is rather old

The camera is pretty bare-bones. Additional functionality can be implemented by you.

That is probably from a custom camera solution such as Defold-Orthographic