Skip to content

Commit

Permalink
Correctly request physical material from foot traces
Browse files Browse the repository at this point in the history
  • Loading branch information
Sixze committed Oct 19, 2021
1 parent 91c988c commit 8dc0301
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Source/ALS/Private/AlsAnimationInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,14 @@ void UAlsAnimationInstance::RefreshFootOffset(FAlsFootState& FootState, FVector&
auto FootLocation{FootState.FinalLocation};
FootLocation.Z = GetSkelMeshComponent()->GetSocketLocation(UAlsConstants::RootBone()).Z;

FCollisionQueryParams QueryParameters{ANSI_TO_TCHAR(__FUNCTION__), true, AlsCharacter};
QueryParameters.bReturnPhysicalMaterial = true;

FHitResult Hit;
GetWorld()->LineTraceSingleByChannel(Hit,
FootLocation + FVector{0.0f, 0.0f, FeetSettings.IkTraceDistanceUpward},
FootLocation - FVector{0.0f, 0.0f, FeetSettings.IkTraceDistanceDownward},
UEngineTypes::ConvertToCollisionChannel(FeetSettings.IkTraceChannel),
{ANSI_TO_TCHAR(__FUNCTION__), true, AlsCharacter});
UEngineTypes::ConvertToCollisionChannel(FeetSettings.IkTraceChannel), QueryParameters);

#if ENABLE_DRAW_DEBUG
if (UAlsUtility::ShouldDisplayDebug(AlsCharacter, UAlsConstants::TracesDisplayName()))
Expand Down
5 changes: 4 additions & 1 deletion Source/ALS/Private/Notify/AlsAnimNotify_FootstepEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ void UAlsAnimNotify_FootstepEffects::Notify(USkeletalMeshComponent* MeshComponen
}
else
{
FCollisionQueryParams QueryParameters{ANSI_TO_TCHAR(__FUNCTION__), true, MeshComponent->GetOwner()};
QueryParameters.bReturnPhysicalMaterial = true;

FHitResult Hit;
if (World->LineTraceSingleByChannel(Hit, FootTransform.GetLocation(),
FootTransform.GetLocation() - FVector{
0.0f, 0.0f, FootstepEffectsSettings->SurfaceTraceDistance
},
UEngineTypes::ConvertToCollisionChannel(FootstepEffectsSettings->SurfaceTraceChannel),
{ANSI_TO_TCHAR(__FUNCTION__), true, MeshComponent->GetOwner()}))
QueryParameters))
{
#if ENABLE_DRAW_DEBUG
if (bDisplayDebug)
Expand Down

0 comments on commit 8dc0301

Please sign in to comment.