Setting bottom bounds with Orthographic camera

I’d like the camera to scroll in all directions apart from down. How can I set the bottom bounds?

Not like this, that’s for sure (this causes the camera to flicker):

Minimal project:
OrthographicCameraBounds.zip (249.4 KB)

When using Very Large Numbers:

It seems to work, but the player is moved to the lower left corner:

What am I missing?

Is it always in the corner? Or only at the beginning?

When I opened your repro and only changed the bounds to what you presented - everything is working as expected and player is in the center.

Now this has turned into a “mysterious problem”!

Downloading the project I first posted, using these settings:

I get this result:

@Pawel could you zip up your project that works, so I can test it please?

1 Like

OrthographicCameraBounds.zip (247.3 KB)

It is literally your project with changed bounds, strange :thinking:

In your latest video it looks ok, only sprite was not displayed on top of bg

The sprite IS there. Just at the bottom left corner.

Edit: The zip you sent above looks exactly the same as the video above - it works, but the character is at the bottom left corner.

Help?!

Maybe it could have something to do with screen resolution? I’m running Mac on a high res display.

Double-checked - the sprite is still in the center on my laptop (Win10)

I have a note to investigate this. I’m currently in the middle of another task (Android App Bundles). I’ll take a look when I need a break from Android.

3 Likes

Any idea what can cause this? The plan is to use this as a game mechanic - drop outside of the bounds and you’re toast.

I’ve tried to constrain the camera manually by moving it manually and stopping it when it reaches a certain point, but haven’t been able to quite make it work. Would be great to be able to use the bounds out of the box.

I haven’t had time to investigate it yet I’m afraid.

1 Like
  1. Thought I’d add in my 2c… The camera seems to be doing it’s job when following an animated GO in the game. Deadzones are working smooth. The camera stops following (paning) whenever I try to modify any of the bounds_… properties. The camera resets (0, 0) and it also centers it on that position.
    Configuration-wise I have a Collection (a level which is loaded via a proxy) a few collections in there acting like some spine character + sprites, at the same level I have the camera GO and inside it the camerascpit path “/orthographic/camera.script” and url “/camera#camerascript”. It is set to follow one of the GO containing a spine animated characters.
    Projection is FIXED_AUTO, and it does the same result (stops on any of the bounds ~= 0) for other projection modes.
    defold_cam_ss

  2. I think the ortographic camera is a really good direction in handling rendering needs without having to dig deep into 3D cameras works. I for instance am pretty baffled when trying to understand the difference between set_view (a 4x4 matrix describing stuff about the camera view?) and set_viewport (a rectangle that’s sort of a view … therefore the confusion in terms???)… I know it’s obvious for many of you but a 2D mindset finds it pretty hard to understand, so please free to educate me.

  3. Is there a way for me to set debug points into the “ortographic/camera.lua”? It is added as a dependency, should I download the zip and copy in the files?

Can’t you set breakpoints in Lua code in library dependencies?

Oh, I have to click to the right of the number now, I think I was able to just click on the line number previously. Had to spam a few clicks to see the red breakpoint dot. If I try to print out stuff, changes are not saved though, but that’s probably the intended way to use libs, correct?

Correct!