Unreal CameraShake

250x250

Unreal CameraShake

Unreal에서 간단하게 CameraShake를 구현하겠습니다.

"LegacyCameraShake" Class를 생성해줍니다.

(5.1 이전버전에서 "MatineeCameraShake".)

LegacyCameraShake Setting

걷고있을때와 달리고있을때 이렇게 두개를 만드려고합니다.

Walk_LegacyCameraShake 생성자.

bSingleInstance = true;
OscillationDuration = 0.2; //진동지속시간
/*위치 회전*/
RotOscillation.Pitch.Amplitude = 0.3; //회전진동,진폭. 
RotOscillation.Pitch.Frequency = 12;
RotOscillation.Yaw.Amplitude = 0.3;//회전진동,진폭.
RotOscillation.Yaw.Frequency = 6;
RotOscillation.Roll.Amplitude = 0.2;
RotOscillation.Roll.Frequency = 3;
/*loc Oscillation*/
LocOscillation.Z.Amplitude = 0.6;
LocOscillation.Z.Frequency = 12;

Run_LegacyCameraShake 생성자.

bSingleInstance = true;
OscillationDuration = 0.2; //진동지속시간
/*위치 회전*/
RotOscillation.Pitch.Amplitude = 0.5; //회전진동,진폭.
RotOscillation.Pitch.Frequency = 17;
RotOscillation.Yaw.Amplitude = 0.5;//회전진동,진폭.
RotOscillation.Yaw.Frequency = 8;
RotOscillation.Roll.Amplitude = 0.25;
RotOscillation.Roll.Frequency = 5;
/*loc Oscillation*/
LocOscillation.Z.Amplitude = 2;
LocOscillation.Z.Frequency = 17;

적용하기.

이런식으로 적용할 수 있습니다.

void AHorrorPlayerController::PlayerTick(float DeltaTime)
{
	Super::PlayerTick(DeltaTime);
	//#include <GameFramework\CharacterMovementComponent.h>
	UCharacterMovementComponent* CharacterMovementComponent = Cast<UCharacterMovementComponent>(GetPawn()->GetMovementComponent());
	//#include <Kismet\KismetMathLibrary.h>
 	float GroundSpeed = UKismetMathLibrary::VSizeXY(CharacterMovementComponent->Velocity);
	float PlayCameraShakeScale = UKismetMathLibrary::MapRangeClamped(GroundSpeed, 0, 250, 0.f, 1.f);
	ClientStartCameraShake(URunLegacyCameraShake::StaticClass() , PlayCameraShakeScale);
}

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Plugins/GameplayCameras/ULegacyCameraShake?application_version=5.3

 

ULegacyCameraShake

Legacy camera shake which can do either oscillation or run camera anims.

dev.epicgames.com

 

Designed by JB FACTORY