Skip to content

Line Trace By Channel

At a glance

Lives in: Blueprint API / Collision - Returns: Boolean plus an FHitResult; true means a blocking hit was found - Fails by: returning false while execution continues - Main inputs: Start, End, trace channel, ignored actors, trace complexity, and debug drawing - Official docs: Line Trace By Channel

The one-minute version

  • Line Trace By Channel asks the collision system: what is the first blocking thing along this line segment?
  • The line is not "from the player" by magic. You choose Start and End, usually Camera Location and Camera Location + Camera Forward Vector * Distance.
  • The trace channel is the question the line asks. Visibility is common for interaction and aim checks; Camera is usually for camera obstruction; a custom channel is often cleaner for weapons or interactables.
  • The Return Value is true only when the trace found a blocking hit. Read Out Hit with Break Hit Result only after that branch.
  • If the first thing you hit is yourself, turn on Ignore Self and add the shooter, weapon, projectile owner, or other known non-target actors to Actors to Ignore.
  • Draw Debug Type only draws the trace for you. It does not change collision, range, filtering, or the result.

What it actually does

A line trace is a collision query, not a physical object. It does not move an actor and it does not create a beam in the world. Unreal tests a straight line segment from Start to End against components that have query collision and an answer for the chosen trace channel.

pseudocode of the engine behavior - not engine source

function LineTraceByChannel(World, Start, End, TraceChannel, Options):
    Params = collision query params from Options
    Params.ignored actors += ActorsToIgnore
    if IgnoreSelf:
        Params.ignored actors += self actor for this Blueprint context

    Hit = World.LineTraceSingleByChannel(Start, End, TraceChannel, Params)

    if DrawDebugType is not None:
        draw the attempted line, using hit color if Hit blocked

    return Hit.foundBlockingHit, Hit

The important word is blocking. A single line trace by channel does not mean "give me every actor along this ray." It returns the nearest blocking hit for that trace channel. Components that ignore the channel are skipped. Components that are not using query collision are not useful to the trace.

The trace channel is compared against each component's trace response. That is separate from the component's object type. A mesh can be a WorldStatic object, block player movement, ignore the Camera trace channel, and block the Visibility trace channel. Those are different rows in the same collision setup.

Building Start and End

The line has two endpoints. For a first-person interaction trace:

Start = FirstPersonCamera.GetWorldLocation
End   = Start + FirstPersonCamera.GetForwardVector * 1500

Line Trace By Channel
    Start = Start
    End = End
    Trace Channel = Visibility
    Ignore Self = true

For a third-person game, be explicit about whether the question comes from the camera or the character:

You want Start from Why
What is under the crosshair? Camera location and camera forward vector. The camera owns the aim point the player sees.
What does the weapon muzzle physically hit? Muzzle scene component location and forward vector. The weapon may be beside or below the camera.
Can this actor see that actor? Eye/head/muzzle location toward target location. You are testing line of sight between two world points.

Camera traces are common because they match the player's screen. Muzzle traces are common because they match the weapon. Many shooters use both: trace from the camera to pick an aim point, then trace or fire from the muzzle toward that point so walls beside the weapon still matter.

When it fails (and what failure does)

The node has no Failed execution pin. Failure looks like this:

Line Trace By Channel
-> Return Value = false
-> Out Hit does not name a blocking target you should use
-> execution still continues

Common causes:

  1. Nothing blocks that trace channel. The component may block Pawns but ignore Visibility, or your custom trace channel may not be set up on the target.
  2. You used the wrong channel. Camera and Visibility are not synonyms. Pick the channel by the question the trace asks.
  3. The target has no query collision. Trace queries need collision enabled for queries. A visual mesh can look solid while the trace sees nothing.
  4. Start and End are wrong. A zero-length trace, a short distance, or a forward vector from the wrong rotation can make the line miss the thing on screen.
  5. You ignored the actor you wanted. Actors to Ignore is a hard filter. A reused array from another trace can quietly hide valid targets.
  6. You did not ignore yourself. If the line starts inside the player capsule, weapon mesh, or held item, the first blocking hit may be your own actor.
  7. Trace Complex does not match the collision you expect. Simple collision tests authored collision shapes. Complex collision tests mesh triangles where supported. Use the one that matches the target and cost you intend.

Failure does not print a warning, run different gameplay code, try another channel, or extend the line. Branch on the Return Value before using the hit.

Reading the Hit Result

Out Hit is an FHitResult: the report for the blocking hit. For beginner Blueprints, the usual fields are:

Field Beginner translation
Hit Actor The actor that owns the component the trace hit. Usually your gameplay target.
Hit Component The exact component hit. Useful when one actor has a capsule, mesh, shield, or trigger.
Impact Point The world point on the surface where the line hit. Spawn sparks, decals, and widgets here.
Impact Normal Direction facing out from the hit surface. Use it to orient decals or effects.
Blocking Hit Whether this result is a blocking hit. It should match the Return Value for this node.
Distance How far from Start to the hit location, when filled by the query path.
Physical Material Surface material, if the query requested it and the component supplies one.

Do not use Hit Actor as if it is always your enemy or interactable. A wall, glass pane, weapon mesh, trigger blocker, or your own capsule can all be the first blocking result. Filter after the trace:

Line Trace By Channel
-> Branch Return Value
    true:
        Break Hit Result
        Hit Actor -> Does Implement Interface (BPI_Interactable)
        true -> Interface Message: Interact
    false:
        do nothing

The self-hit problem

The trace starts at a point in the world. If that point is inside your own collision, the nearest blocking hit can be you.

Ignore Self handles the common case where the Blueprint running the node is the actor you want to skip. It does not mean "ignore my whole team" or "ignore every actor related to me." Add those explicitly:

Actors to Ignore:
    self
    Get Owner
    Get Instigator
    equipped weapon actor

For a projectile or weapon actor, self might be the weapon, not the pawn who fired it. That is why the owner/instigator setup from Spawn Actor from Class matters.

If the trace still starts inside geometry, move the start point slightly forward:

Start = CameraLocation + CameraForward * 20
End   = CameraLocation + CameraForward * 1500

Do that only when it matches the gameplay. Moving the start forward can also skip something very close to the camera.

Draw Debug Type

Debug drawing is for seeing the query:

Draw Debug Type What it is for
None Normal gameplay path.
For One Frame Per-frame traces, such as Tick while aiming.
For Duration A short-lived line you can inspect after one button press.
Persistent A manual debugging session where you intend to clean up the clutter.

The colors are presentation only. A debug line that appears to pass through an object usually means the object does not block the trace channel, the query hit something earlier, or you are looking at a different component than the trace tested.

What Line Trace By Channel does not do

  • It does not apply damage, interact, select, or open anything. It only returns a query result.
  • It does not move a projectile. Use projectile movement or your own movement logic for physical travel.
  • It does not report every hit along the line. Use a multi trace when you need a list.
  • It does not use object types as its primary filter. Use object traces when the question is "which object types should count?"
  • It does not ignore the shooter unless you tell it to.
  • It does not replicate. Run authoritative hit-scan weapon or interaction decisions on the server when multiplayer matters.

The pattern everyone actually uses

For interaction:

Input Interact
-> Camera Location
-> Camera Forward Vector
-> End = Location + Forward * 500
-> Line Trace By Channel (Visibility, Ignore Self)
-> Branch Return Value
-> Break Hit Result
-> Hit Actor
-> Does Implement Interface (BPI_Interactable)
-> Interface Message: Interact

For a simple hit-scan weapon:

Input Fire
-> Camera trace to find aim point
-> if camera trace hit:
       AimPoint = Hit.ImpactPoint
   else:
       AimPoint = CameraLocation + CameraForward * Range
-> Muzzle trace from muzzle location toward AimPoint
-> filter Hit Actor
-> Apply Point Damage
-> spawn impact effect at Hit.ImpactPoint

The C++ twin, for the curious (our own example code):

void ATrainingCharacter::InteractTrace()
{
    const FVector Start = FirstPersonCamera->GetComponentLocation();
    const FVector End =
        Start + FirstPersonCamera->GetForwardVector() * 500.0f;

    FCollisionQueryParams Params(SCENE_QUERY_STAT(InteractTrace), false);
    Params.AddIgnoredActor(this);

    FHitResult Hit;
    const bool bHit = GetWorld()->LineTraceSingleByChannel(
        Hit,
        Start,
        End,
        ECC_Visibility,
        Params);

    if (!bHit || !IsValid(Hit.GetActor()))
    {
        return;
    }

    IInteractable::Execute_Interact(Hit.GetActor(), this);
}

Lookalikes - which one do I want?

Node Use when Watch out
Line Trace By Channel You want the first blocking hit for one trace channel. The target must block that trace channel.
Multi Line Trace By Channel You need hits up to and including the first blocking hit. It can include several results, so filter and sort deliberately.
Line Trace For Objects You want to include object types such as Pawn or WorldDynamic. It asks a different question than a trace channel.
Line Trace By Profile You want a named collision profile to define the query. Profiles are project settings; inspect what they contain.
Sphere / Capsule / Box Trace A zero-width line is too precise and you need forgiveness or volume. Sweeps can hit earlier because the shape has radius/extent.
Event Hit You want a callback from actual blocking movement or physics contact. A trace is a query you call; a hit event is reported by movement/collision.
On Component Begin Overlap You want trigger-style enter/exit logic. Overlap is not a raycast and does not stop at the first blocker.

Rule of thumb: use a line trace for a one-shot ray question, a shape trace when the ray is too thin, a multi trace when you need more than the first blocker, and collision events when the world should notify you.

Going deeper