Skip to content

Commit

Permalink
Revert footstep trace to kismet version
Browse files Browse the repository at this point in the history
There were compile issues in the change to reduce allocations in
footstep traces. Revert back to the kismet version, but use MeshOwner
as the world context object so that bIgnoreSelf can ignore it.  That
way MeshOwner->Children can be used directly as the rest of the ignore
list, avoiding the allocations.
  • Loading branch information
muchcharles committed May 19, 2021
1 parent 5eb4d3a commit 0b1256a
Showing 1 changed file with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "Components/AudioComponent.h"
#include "Engine/DataTable.h"
#include "Kismet/KismetSystemLibrary.h"
#include "Library/ALSCharacterStructLibrary.h"
#include "PhysicalMaterials/PhysicalMaterial.h"
#include "NiagaraSystem.h"
Expand Down Expand Up @@ -46,25 +47,8 @@ void UALSAnimNotifyFootstep::Notify(USkeletalMeshComponent* MeshComp, UAnimSeque

FHitResult Hit;

ECollisionChannel CollisionChannel = UEngineTypes::ConvertToCollisionChannel(TraceChannel);

FCollisionQueryParams Params(SCENE_QUERY_STAT(ALSFootstep), true /*bTraceComplex*/, MeshOwner);
Params.bReturnPhysicalMaterial = true;
for (auto& Child : MeshOwner->Children)
{
Params.AddIgnoredActor(Child);
}

bool const bHit = MeshComp->GetWorld() ? World->LineTraceSingleByChannel(Hit, FootLocation, TraceEnd, CollisionChannel, Params) : false;

#if ENABLE_DRAW_DEBUG
if (MeshComp->GetWorld())
{
DrawDebugLineTraceSingle(MeshComp->GetWorld(), FootLocation, TraceEnd, DrawDebugType, bHit, Hit, TraceColor, TraceHitColor, DrawTime);
}
#endif

if (bHit)
if (UKismetSystemLibrary::LineTraceSingle(MeshOwner /*used by bIgnoreSelf*/, FootLocation, TraceEnd, TraceChannel, true /*bTraceComplex*/, MeshOwner->Children,
DrawDebugType, Hit, true /*bIgnoreSelf*/))
{
if (!Hit.PhysMaterial.Get())
{
Expand Down

0 comments on commit 0b1256a

Please sign in to comment.