Untitled

기본 캐릭터의 Fire 애니메이션의 프레임을 잘라서 보정을 했다

HipFireMontage

몽타뉴를 생성하고 , Slot 을 생성해서 WeaponFire 슬롯을 만들고 거기에 trimmed fire 애니메이션을 넣었다

Untitled

Animation Blueprint 설정

Untitled

음 가장 이해가 안가는 부분이다 UE 에서 Cache 화는 왜 하는걸까>?

<aside> 😃 So drag off.

And type cashed and select new save cashed Poes, we're going to rename this cashed ground locomotion.

지상 이동,

So what are we doing here exactly?

Well, the ground locomotion state machine contains data about the pose for our character, for any given frame.

But we can cash that off, which is basically to say save that information.

We use it by rightClicking and typing, use cached and we'll see use cached pose cached ground locomotion.

So we're essentially saving off the Pose information, and if we wanted, we can just plug it back in the outpost and we'd have the same effect as if we had just plugged straight from ground locomotion into output pose.

I'm going to hold alt and click to disconnect that execution wire because we're going to take this cash to pose.

And before we plug it in to output pose , we're going to run it through our weapon fire slot.

So drag off and type slot.

And shoes slot default slot, and with our slot nodes selected up here in the details panel, we can change slot name and select weapon fire.

So now this ground locomotion post data is going through a weapon fire slot node.

Now, let's connect this to output pose.

If we're going through the weapon fire slot node, then any animations that we play from the montage that uses the weapon fire slot will actually be incorporated into our Poes data for the output Pose.

만약 우리가 무기 사격 슬롯 노드를 통과한다면, 무기 사격 슬롯을 사용하는 몽타주에서 재생되는 모든 애니메이션은 실제로 출력 포즈에 대한 Poes 데이터에 통합될 것입니다.

So now we just need to decide when to play this animation in our Hipp fire montage.

We're going to do that from C++.

</aside>

결국 우리가 기존에 사용했던 애니메이션을 캐싱하고 ( 저장하고 ) 그리고 그 캐싱된 애니메이션을 참조하면서 우리가 만들었던 애니메이션 몽타뉴 슬롯을 통과하게끔 함으로써 기존의 애니메이션과 Weapon Fire 이라는 애니메이션이 합산되서 OutPose 에 출력이 되게끔 하려고 한 것 이다.

즉 땅의 동작의 애니메이션을 캐싱해서 저장하고 , 해당 캐싱한 값과 WeaponFire 슬롯을 통합해서 출력하려고 캐싱을 하고 연결을 한 것 이다.

그래프 설정에 이은 코드 설정

Untitled

void AShooterCharacter::FireWeapon()
{
	UE_LOG(LogTemp, Warning, TEXT("Fire Weapon."));
	if (FireSound)
	{
		UGameplayStatics::PlaySound2D(this, FireSound);
	}

	const USkeletalMeshSocket* BarrelSocket = GetMesh()->GetSocketByName("Barrel");
	if (BarrelSocket)
	{
		const FTransform SocketTransform = BarrelSocket->GetSocketTransform(GetMesh());
		
		if (MuzzleFlash)
		{
			UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), MuzzleFlash, SocketTransform);
		}

	}

	UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();
	if (AnimInstance && HipFireMontage)
	{
		AnimInstance->Montage_Play(HipFireMontage);
		AnimInstance->Montage_JumpToSection(FName("StartFire"));
	}

}

Blend Time 설정

Untitled

그리고 Blend Time 을 0초로 설정하므로써 다시 재생하는 속도가 느리지 않도록 설정했다

궁금증 Blend Time 을 0으로 설정하지 않는다면??

30AA8400-A15E-4EB4-A2BA-0E361133F595.png

보면 두 애니메이션 간의 Blend , 즉 부드럽게 연결하기 위한 보정 설정이다. 그런데 워낙 사격 애니메이션이 짧다 보니까 , 만약 Blend 시간을 0으로 하지 않으면 , 사격할 시간에 Blending 을 하기 때문에 사격 애니메이션이 안 보일수가 있다.

근데 굳이 캐싱안해도 잘 되는데?