Replicated

** [Drag Down] GAS Prediction 기반 AnimNotify 처리 ** 본문

언리얼 엔진/Drag Down (캡스톤 디자인)

** [Drag Down] GAS Prediction 기반 AnimNotify 처리 **

라구넹 2025. 3. 27. 12:09

자 이제 AnimNotify 만들어서 태그 날리게 하자

 

AnimNotify 만들고

 

노티파이 설정

 

이제 애니메이션 Notify 설정해주면 됨


그래서 Notify에서 게임플레이 태그 날리는 건 어디서 해야 하는가?

결국 지금 게임 플레이 태그 날린다 -> Trace 발생시킨다

 

근데 고민 점

Notify를 통해 태그를 날리는 건 클라이언트에서 해야 하는가, 서버에서 해야 하는가?

Prediction 처리는 어떻게 진행되는가? 

결론: 클라이언트에서 태그 쓰면 알아서 서버에서 처리 된다

 

// Fill out your copyright notice in the Description page of Project Settings.


#include "Animation/AnimNotify_HitCheck.h"
#include "AbilitySystemComponent.h"
#include "AbilitySystemGlobals.h"
#include "GameFramework/Actor.h"
#include "Character/DDCharacterPlayer.h"

void UAnimNotify_HitCheck::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
	if (!MeshComp) return;


	AActor* Owner = MeshComp->GetOwner();
	if (!Owner) return;

	UAbilitySystemComponent* ASC = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Owner);
	if (!ASC) return;

	FGameplayEventData EventData;
	FGameplayTag HitTag = FGameplayTag::RequestGameplayTag(FName("Event.PushTrigger"));
	EventData.EventTag = HitTag;
	EventData.Instigator = Owner;
	EventData.Target = Owner;

	ASC->HandleGameplayEvent(HitTag, &EventData);
}

Notify를 이렇게 구성한다

이러면 클라이언트에서 미리 예측해서 태그를 날리면, 서버에서도 재실행하는 방식이 될 것이다.

 

 

일단 멀쩡히 실행되는 거 같긴 한데

제대로 되는 건지는 Effect까지 적용되어야 알 수 있다