SimpleCamera

Monkey Programming Forums/User Modules/SimpleCamera

Nobuyuki(Posted 2015) [#1]
Heya guys,



I'm currently working on a camera system for my next project, and I thought I'd share some of the progress with everyone in case they were looking to implement a camera in their own game. Right now, the class only supports one focal point, but soon I'll be adding more to it to support multiple focal points, along with filtered zooming and level boundary constraints. The viewport is also hard-coded into the project for now, so it won't support AutoFit out of the box most likely (this is an easy fix; I just haven't bothered testing it with an autoscaler yet)

What you can do with the current prototype is be able to specify free roam areas where the camera will be "lazy", and buffer zones where the camera's filtering ramps up so you don't get nauseatingly fast movement once the camera starts to pan. This type of buffered movement will also exist with the zooming.

Please give it a spin, and let me know what you think :)

https://github.com/nobuyukinyuu/SimpleCamera


DruggedBunny(Posted 2015) [#2]
Looks cool... would it/could it support rotation of the camera too?


Nobuyuki(Posted 2015) [#3]
I suppose I could add rotation in there, although really that's something you'd probably be best off adjusting manually anyway. It's likely that if I did implement it, the free roam features would be tied to the angle, since applying the math otherwise would probably be a real pain. It wouldn't work with multiple focal points, either, for similar reasons (the minimum bounding box calculation is for AABB's only)


Nobuyuki(Posted 2015) [#4]
Respect for pre-existing global matrix settings has been added. I have absolutely no clue why I hadn't done this before, since this means that it couldn't be used with autofit without some major screwing around. As a result, SimpleCamera no longer relies on device-specific sizes to perform its adjustments, and needs you to initialize it with a viewport size. This size can remain static to the virtual screen size when using autofit / AutoScale.

Sorry, no progress on zooming constraints or rotation! My current project doesn't use either of these things, so it's not a priority right now.....


Nobuyuki(Posted 2016) [#5]
Update to support level constraints for current project. Still no dynamic anchor return points, rotation, zoom, or averaged focal point position. Sorry about that!