2025-01-24TIL 애니메이션 적용 복습

별빛에소원을·2025년 1월 26일

TeamSparta-Unreal1기-TIL

목록 보기
32/90

알고리즘

문자열 나누기를 풀었다. Index를 이용해서 풀어야 한다는 것을 기억하고 풀었기 때문에 크게 어렵지 않게 풀었다.

복습

게임모드는 다음과 같은 것들을 구현할 수 있다.

PlayerController는 IMC를 구현할 수 있는데, GetLocalPlayer()를 통해 Player에 SubSystem을 가지고 와서 Mapping을 하면 된다.

	if (ULocalPlayer* LocalPlayer = GetLocalPlayer())
	{
		if(UEnhancedInputLocalPlayerSubsystem* Subsystem = 
			LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())
		{
			if(IMC) Subsystem->AddMappingContext(IMC, 0);
		}
	}

BP로 구현한다면 다음과 같이 하면된다.

IMC는 다음과 같은 기능들을 가지고 있다.

Character는 다음 매핑된 기능을 구현하면 된다. SetupPlayerInputComponent을 통해 Binding할 수 있다.

	if (UEnhancedInputComponent* Enhanced =
		Cast<UEnhancedInputComponent>(PlayerInputComponent))
	{
		if (ASpartaController* SpartaController = Cast<ASpartaController>(GetController()))
		{
        	Enhanced->BindAction(
            	Action,TriggerEvent, this, 구현함수
            )
        }
    }

BP로 구현한다면 다음과 같이 구현할 수 있다.


애니메이션은 다음과 같이 구현하면 된다.

상태에 대한 값들을 구할 필요가 있다.
MovementComponent에서 Velocity값을 이용해서 움직임에 대한 값을 가져올 수 있는데
Velocity값의 Length값을 이용해서 값을 가져오면 움직임의 크기를 구할 수 있다.
나머지는 MovementComponent의 기능을 이용해서 구할 수 있다.

profile
취미로 게임하는사람

0개의 댓글