rendercam icon indicating copy to clipboard operation
rendercam copied to clipboard

Camera focus zone and viewport limit bounds

Open selimanac opened this issue 7 years ago • 6 comments
trafficstars

Hello @rgrams

As I said on Defold forums, I love rendercam. Thank you again. I added experimental features to rendercam for my game.

  • Camera focus zone Rectangle zone. Similar to this, but much more simple

  • Camera limits Rectangle for limiting camera movements. Like tilemap or any rect.

I'm not sure if these updates are the most efficient (performance-wise) way or not. i'll be glad if you can check them out. Since I'm using only one ortho cam, I didn't test it with multiple ortho/perspective cams.

If you want me to do some updates, please feel free to contact with me. I'm not a talented dev like you, but I can try my best. Maybe we can merge it, if you find them useful.

Here is my branch

selimanac avatar Jan 05 '18 11:01 selimanac

Whoa, very cool! I actually considered making these features in the beginning (Defold Orthographic has them), but I wasn't too interested in them for my own use, so I didn't bother. But this is great! I'll need some time to go over it thoroughly, but it looks pretty good. I'm impressed you managed to decipher my code.

"I'm not a talented dev like you"

Hah! Pff, nonsense. I'm an idiot with no idea what he's doing just like everyone else. :) I fought with camera stuff over and over again for almost a full year before making Rendercam.

rgrams avatar Jan 05 '18 16:01 rgrams

I know Defold Orthographic. It is a good cam too. Those features and of course the code that I use are similar with Defold Orthographic. Also with other stuff from forum. This is the way of learning and open source. I prefer rendercam and made those extensions for my personal use.

I made some changes just a couple a minutes ago. I removed unnecessary message posting stuff from event.

Thanks again

selimanac avatar Jan 05 '18 17:01 selimanac

Hey Selim, can you make a pull request with your stuff to my "dev" branch?

rgrams avatar Jan 12 '18 01:01 rgrams

Just a little update on this for anyone checking. I am very slowly working on a Version 2.0 which will include these features. They work fine for 2D orthographic cameras right now (functions renamed to set_bounds and set_follow_deadzone), if you want to use them, change your dependency link to this:

https://github.com/rgrams/rendercam/archive/2.0Beta.zip

Before I consider this release-worthy, it will need:

I think the follow deadzone is okay, but . . .

  • check it with all camera types
  • try to test for any edge cases

set_bounds definitely needs some work:

  • To work with 2D-oriented perspective cameras
  • To fail with decent error messages if it's not going to work
    • . . . if there's any way to tell if it's not working/shouldn't work . . .
  • To behave better when the bounds are smaller than the visible area
  • Needs to be based on world position instead of local?
    • test with the camera as a child of a game object, with some offset, etc.

rgrams avatar Feb 10 '18 14:02 rgrams

I'm using dev branch with deadzone(orthographic) everyday. But still developing my game's base logics. So these are not my main focus for now. But they will and I'm going to use them heavily for lots of different situations. I will definitely report problems or my solutions.

selimanac avatar Feb 10 '18 15:02 selimanac

Cool. Yeah, I am just writing down a to-do list for myself mostly. If you, or anyone else wants to contribute to this, great(!), if not, I will get to it at some point. I have my own games to work on as well. I just want to keep this stuff in a dev/beta branch until it's more fool-proof.

rgrams avatar Feb 10 '18 15:02 rgrams