Last active
July 2, 2024 08:48
-
-
Save MarkJGx/c903e3bc355a76839f51a38230eb27c0 to your computer and use it in GitHub Desktop.
Unreal Engine Async TraceDelegate lambda usage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @MarkJGx this is how you use async trace delegates. | |
FTraceDelegate TraceDelegate = FTraceDelegate::CreateWeakLambda( | |
this, [](const FTraceHandle& TraceHandle, FTraceDatum& TraceResults) | |
{ | |
if(TraceResults.OutHits.Num() > 0) | |
{ | |
const FHitResult& Result = TraceResults.OutHits[0]; | |
} | |
}); | |
GetWorld()->AsyncLineTraceByChannel(EAsyncTraceType::Single, Start, End, ECC_Hitscan, CollisionParams, | |
FCollisionResponseParams::DefaultResponseParam, &TraceDelegate); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment