Home

Awesome

Unity-CameraSizeToVelocity2D

Example

example

Description

Use this simple script to tie your camera size to the target RigidBodys velocity. In a 2D side-scrolling game this can be used to show you more of the game area when the player is moving faster.

Usage

Assign a RigidBody2D component to the target variable, the script uses this objects velocity to determine the size of the camera.

Assign a minimun and maximum values to the mincam and maxcam variables to control the overall size of the camera.