DIGIT-ARC read-only archive · snapshot: July 23, 2026

Smart Camera for Unity 2D Platfomers

4 posts · originally from https://geek.digit.in/community/threads/smart-camera-for-unity-2d-platfomers.191891/

Nerevarine
Nerevarine Original post #1
Jun 6, 2015 at 11:14 PM
I made my own Camera logic scripts which I have uploaded to Github for anyone to use in their project (2D platformer/sidescroller)

*github.com/Sunil95/Unity-2D-Platformer-Smart-Camera-Implementation

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
Code:
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
RCuber
RCuber #2
Jun 6, 2015 at 11:50 PM
do you have a sample demo made?
Nerevarine
Jun 7, 2015 at 12:02 AM
yep, just download the demo scene from the repo

- - - Updated - - -

do you have a sample demo made?

EDIT : I Updated it, i never realised I had not uploaded an .exe demo, now it should be fixed
Anorion
Anorion #4
Jun 7, 2015 at 2:15 AM
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