Skip to content

AnimNotify_GameplayCue Looping #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,35 @@ void UGBFAnimNotify_GameplayCueLooping::NotifyBegin( USkeletalMeshComponent * me

if ( owning_actor != nullptr && GameplayCueTag.GetTagName() != NAME_None )
{
Parameters.TargetAttachComponent = mesh_component;
UGameplayCueFunctionLibrary::AddGameplayCueOnActor( owning_actor, GameplayCueTag, Parameters );
FGameplayCueParameters gameplay_cue_parameters;

if ( bUseLineTraceToFillParameters )
{
FHitResult hit_result;

const auto trace_start_location = owning_actor->GetActorLocation();
const auto trace_end_location = owning_actor->GetActorLocation() + LineTraceVector;

FCollisionQueryParams collision_params;
collision_params.bReturnPhysicalMaterial = bGatherPhysicalMaterial;
collision_params.AddIgnoredActor( owning_actor );

owning_actor->GetWorld()->LineTraceSingleByChannel( hit_result, trace_start_location, trace_end_location, TraceCollisionChannel, collision_params );

if ( bGatherPhysicalMaterial )
{
gameplay_cue_parameters.PhysicalMaterial = hit_result.PhysMaterial;
}

if ( bGatherTraceHitPointLocation )
{
gameplay_cue_parameters.Location = hit_result.Location;
gameplay_cue_parameters.Normal = hit_result.Normal;
}
}

gameplay_cue_parameters.TargetAttachComponent = mesh_component;
UGameplayCueFunctionLibrary::AddGameplayCueOnActor( owning_actor, GameplayCueTag, gameplay_cue_parameters );
}
}

Expand All @@ -22,7 +49,8 @@ void UGBFAnimNotify_GameplayCueLooping::NotifyEnd( USkeletalMeshComponent * mesh

if ( owning_actor != nullptr && GameplayCueTag.GetTagName() != NAME_None )
{
Parameters.TargetAttachComponent = mesh_component;
UGameplayCueFunctionLibrary::RemoveGameplayCueOnActor( owning_actor, GameplayCueTag, Parameters );
FGameplayCueParameters gameplay_cue_parameters;
gameplay_cue_parameters.TargetAttachComponent = mesh_component;
UGameplayCueFunctionLibrary::RemoveGameplayCueOnActor( owning_actor, GameplayCueTag, gameplay_cue_parameters );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <Animation/AnimNotifies/AnimNotifyState.h>
#include <CoreMinimal.h>
#include <GAS/GameplayCues/GBFGameplayCueManager.h>

#include "GBFAnimNotify_GameplayCueLooping.generated.h"

Expand All @@ -21,6 +20,21 @@ class GAMEBASEFRAMEWORK_API UGBFAnimNotify_GameplayCueLooping final : public UAn
UPROPERTY( EditAnywhere, Category = "GameplayCue", meta = ( Categories = "GameplayCue", AllowPrivateAccess ) )
FGameplayTag GameplayCueTag;

UPROPERTY( EditAnywhere, Category = "GameplayCue", meta = ( Categories = "GameplayCue", AllowPrivateAccess ) )
FGameplayCueParameters Parameters;
UPROPERTY( EditAnywhere, Category = "Parameters", meta = ( AllowPrivateAccess ) )
bool bUseLineTraceToFillParameters = false;

/* Line trace will start at actor location */
UPROPERTY( EditAnywhere, Category = "Parameters", meta = ( AllowPrivateAccess, EditCondition = "bUseLineTraceToFillParameters" ) )
FVector LineTraceVector;

UPROPERTY( EditAnywhere, Category = "Parameters", meta = ( AllowPrivateAccess, EditCondition = "bUseLineTraceToFillParameters" ) )
TEnumAsByte< ECollisionChannel > TraceCollisionChannel;

/* keep line trace hit point physical material, usefull for gameplay cue's surfaces spawn conditions */
UPROPERTY( EditAnywhere, Category = "Parameters", meta = ( AllowPrivateAccess, EditCondition = "bUseLineTraceToFillParameters" ) )
uint8 bGatherPhysicalMaterial : 1;

/* will override attachment gameplay cue position*/
UPROPERTY( EditAnywhere, Category = "Parameters", meta = ( AllowPrivateAccess, EditCondition = "bUseLineTraceToFillParameters" ) )
uint8 bGatherTraceHitPointLocation : 1;
};