https://github.com/healeycodes/unity-smooth-camera-follow
An extendable C# camera script for a 3D smooth follow. Designed for single-unit top-down use.
https://github.com/healeycodes/unity-smooth-camera-follow
Last synced: about 1 year ago
JSON representation
An extendable C# camera script for a 3D smooth follow. Designed for single-unit top-down use.
- Host: GitHub
- URL: https://github.com/healeycodes/unity-smooth-camera-follow
- Owner: healeycodes
- Created: 2018-05-29T00:08:09.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-01T00:09:45.000Z (almost 8 years ago)
- Last Synced: 2024-10-05T17:42:58.296Z (over 1 year ago)
- Language: C#
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Smooth Camera Follow
Written in C#. Designed for an RTS style camera. With smooth follow (X-,Y-,and Z-axis), and smooth rotate as well. Smooth meaning linear interpolation. Great for a quick game jam camera.
Variables to experiment with:
```C#
public Transform player;
public float moveSmoothTime = 1f; // Lower is slower
public float heightSmoothTime = 1f; // Lower is slower
public float rotationSmoothTime = 0.1f; // Lower is slower
public float followBehindDst = 5f;
public float lookThisFarInFront = 5f;
public float height = 12f;
```
### Setup
Set the object's Transform that you wish to follow to `player`.
The camera will look at a point on the positive Z-axis from the object.
Personally, I like to negatively lerp the `followBehindDst` and `height` values upon player death.
### License
https://mit-license.org/