Smart Camera for Unity 2D Platfomers


I made my own Camera logic scripts which I have uploaded to Github for anyone to use in their project (2D platformer/sidescroller)


Please leave a feedback, I shall update it further as much as possible.. Right now its pretty basic, but much more precise than the standard Unity controller..

Here's a minor description for it
Generic camera controllers/Unity Inbuilt controller simply track the position and movement of the player controller. However this is very imprecise and can look quite odd in fast paced platformers.
The smart camera, uses a rectangular TRAP that encases the player character. The player cannot move out of this TRAP. The camera ONLY starts moving when the player hits the boundaries of the TRAP. This gives a small room for the player to move around without affecting the camera..

Ill keep updating this thread, should anyone require assistance

Ive also attached simple demoscene for anyone to fiddle around.. Right now, my code is very messy, so take note before editing
Last edited:


Sith Lord
Staff member
nice. Looked in the code for the cam.
the bounding box idea is cool, that's probably a good approach, nothing like that here
Scripts/Controllers - Unify Community Wiki
only suggestion is add more comments explaining the script
Top Bottom