Programmer:)
Lerp(선형 보간 함수) 본문
반응형
public static Vector3 Lerp(Vector a, Vector b, float t);
Vector a 와 Vector b 사이의 float t를 반환한다.
주로 한 템포 늦게 플레이어를 따라가는 카메라를 구현할 때 사용한다.
위치,숫자,색 등을 부드럽게 변환할 때 유용하다.
ex)
//Move the gun to the zoom position
transform.localPosition= Vector3.Lerp(transform.localPosition,
zoomPosition, Time.deltaTime * moveSpeed);
//Change the camera field of view
gunCamera.fieldOfView = Mathf.Lerp(gunCamera.fieldOfView,
zoomFov,fovSpeed * Time.deltaTime);
반응형
'공부(개발) > c#' 카테고리의 다른 글
[C#] Stack vs Heap (스택 vs 힙) (0) | 2022.04.10 |
---|---|
[C#] Boxing Unboxing ( 박싱과 언박싱) (0) | 2022.04.03 |
[C#] Struct vs Class (구조체 vs 클래스) (0) | 2022.04.02 |
C# 람다식(Lambda Expression) (0) | 2020.02.20 |
C#델리게이트(Delegate) (0) | 2020.02.20 |
Comments