RealDocs

UKismetSystemLibrary::LineTraceMultiByProfile

function Engine Blueprint Since 4.0
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticBlueprintCallable

Description

Traces a line from Start to End against the world using a named Collision Profile and returns all overlapping hits plus the first blocking hit. Exposed to Blueprint as 'Multi Line Trace By Profile'.

Caveats & Gotchas

  • Only the single closest blocking result is found — once a blocking hit is reached, no further hits are tested past that point, unlike the ForObjects variants which have no blocking concept at all.
  • OutHits is sorted with the blocking hit (if any) as the last element; treat earlier entries as non-blocking overlaps per the profile's response settings.
  • Behavior depends entirely on how ProfileName is configured in the project — the same call can return very different results across two projects with differently defined profiles of the same name.

Signature

static ENGINE_API bool LineTraceMultiByProfile(const UObject* WorldContextObject, const FVector Start, const FVector End, UPARAM(Meta=(GetOptions=GetCollisionProfileNames)) FName ProfileName, bool bTraceComplex, const TArray<AActor*>& ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>& OutHits, bool bIgnoreSelf, FLinearColor TraceColor = FLinearColor::Red, FLinearColor TraceHitColor = FLinearColor::Green, float DrawTime = 5.0f)

Parameters

Name Type Description Default
WorldContextObject const UObject* World context.
Start const FVector Start of the line segment.
End const FVector End of the line segment.
ProfileName FName The collision profile used to determine which components to hit.
bTraceComplex bool True to test against complex collision, false to test against simplified collision.
ActorsToIgnore const TArray<AActor*>& Actors to exclude from the trace.
DrawDebugType EDrawDebugTrace::Type Debug draw mode.
OutHits TArray<FHitResult>& All hits, sorted from Start to End; the blocking hit (if any) is last.
bIgnoreSelf bool Whether to ignore the world context actor itself.
TraceColor FLinearColor Debug draw color for the trace. FLinearColor::Red
TraceHitColor FLinearColor Debug draw color for hits. FLinearColor::Green
DrawTime float How long the debug draw persists, in seconds. 5.0f

Return Type

bool

Example

Multi trace against a custom 'Interactable' profile C++
TArray<FHitResult> Hits;
TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(this);

const FVector Start = GetActorLocation();
const FVector End = Start + GetActorForwardVector() * 1000.f;

bool bHit = UKismetSystemLibrary::LineTraceMultiByProfile(this, Start, End, FName("Interactable"), false, ActorsToIgnore, EDrawDebugTrace::ForDuration, Hits, true);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.