# Smart Camera for Unity 2D Platfomers



## Nerevarine (Jun 6, 2015)

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

```
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 (Jun 6, 2015)

do you have a sample demo made?


----------



## Nerevarine (Jun 7, 2015)

yep, just download the demo scene from the repo

- - - Updated - - -



RCuber said:


> 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 (Jun 7, 2015)

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


----------

