보간 (Interpolation)

중간에 무언가를 끼워넣음 - 두 값 사이의 값을 얻음

0 -> 1 로 변할 때 바로 1이되는것이 아닌 0.1 0.2 0.3 고 같이 시간차를 두고 변하는 값을 추정하는 것을 의미

 

Ease / InterpTo / InterpConstantTo / SpriongInterp 등이 있다.

 

Ease 같은 경우는 굉장히 다양한 옵션이 있다.

https://historia.co.jp/archives/1976/

 

Lerp (Linear Interpoliation) - 선형 보간

A와 B 사이의 백분율 ( 현재 진행률 - Alpha [0,1] ) 값 반환 ( Vlerp ,  Slerp (구면 선형 보간), Rlerp, Tlerap (FTransform) 등)

T Lerp(const T& A, const T& B, const U& Alpha)

 

FVector UKismetMathLibrary::VLerp(FVector A, FVector B, float V)
{
	return A + V * (B - A);
}	

FRotator UKismetMathLibrary::RLerp(FRotator A, FRotator B, float Alpha, bool bShortestPath)
{
	// if shortest path, we use Quaternion to interpolate instead of using FRotator
	if (bShortestPath)
	{
		FQuat AQuat(A);
		FQuat BQuat(B);

		FQuat Result = FQuat::Slerp(AQuat, BQuat, Alpha);

		return Result.Rotator();
	}

	const FRotator DeltaAngle = B - A;
	return A + Alpha*DeltaAngle;
}

 

 

<T> Interp

Current 에서 Target 으로 보간한다. ( FInterpTo / VInterpTo / RInterpTo / QItnterpTo 등이 있다 )

<T>InterpTo( T1  Current, T2 Target, T3 DeltaTime, T4 InterpSpeed )

빠르게 동작하고 천천히 끝나는 부드러운 도착

 

 

 

<T> InterpConstantTo

InterpTo와 비슷하지만 Current 에서 Target 으로 일정하게 보간한다.

<T>InterpConstantTo(const <T>& Current, const <T>& Target, float DeltaTime, float InterpSpeed)

이 함수들의 공통점은 반환된 중간값을 Tick 함수 안에서 움직일 대상의 위치나 Speed를 대입하는 식으로 작동된다.

'언리얼 > 언리얼 기능' 카테고리의 다른 글

채널 프리셋  (1) 2024.09.23
FRotator  (0) 2024.09.11
UStruct static_cast  (0) 2023.09.04
Delegate 관리  (0) 2023.07.23
Unreal Editor Mode  (0) 2023.07.15

+ Recent posts