pixelfoot / unity-awesomeness

A collection of basic utility scripts for Unity 5, to aid in rapid prototyping.
http://www.pixelfootgames.com
13 stars 1 forks source link

FreeFlightCamera lerping #9

Open mhulse opened 9 years ago

mhulse commented 9 years ago

This script:

https://github.com/patflannery/unity-awesomeness/blob/f09a384c811ed07fa46c76e80b679adcf74aff05/Camera/FreeFlightCamera.js

Apply lerp:

http://docs.unity3d.com/ScriptReference/Mathf.Lerp.html

there's at least two different functions - one for general math, one for vectors (physics stuff). basically yeah you put two values in and it eases between them "interpolates between a and b by t. t is clamped between 0 and 1." but for that script it'd be great to have you accelerate and decelerate when moving you could set the time for the lerp to be like 10 seconds, then you'd pretty much have a "takeoff"