Knowledge base
Knowledge base
Knowledge base
Free, anonymous browsing of Unreal Engine Blueprint examples, node references, and best practices. The same content the WoalzCraft plugin uses to generate Blueprints.
22 results for line trace
Pattern: Input trigger → LineTraceSingle(CameraLocation, CameraLocation + ForwardVector * Distance, Visibility, false, MakeArray(Self), None) → Branch(ReturnValue) → True: BreakHitResult → HitActor → CastTo InteractableInterface → call Interact. End pin is world POSITION not direction. Use DrawDebugType ForOneFrame during dev.
Pattern: GetPlayerController → GetPlayerViewPoint(outputs Location,Rotation) → GetForwardVector(Rotation) → Multiply_VectorFloat(A=Forward, B=TraceDistance) → Add_VectorVector(A=CameraLocation, B=Offset) → LineTraceByChannel(Start=CameraLocation, End=TraceEnd). GetPlayerViewPoint exec in='execute', exec out='then', outputs: 'Location' (Vector) and 'Rotation' (Rotator).
Pattern: LineTraceByChannel → Branch(hit=true) → BreakHitResult → SpawnSystemAtLocation(SystemTemplate=NS_Impact, Location=ImpactPoint, Rotation=MakeRotFromX(ImpactNormal), Scale=(1,1,1), bAutoDestroy=true). Use MakeRotFromX with ImpactNormal to orient effect to surface normal. NS_ prefix is convention for Niagara Systems. SpawnSystemAtLocation is in UNiagaraFunctionLibrary. bAutoDestroy=true means the component cleans itself up after the effect completes.
Pattern: BPI_Interactable interface with Interact(APawn* Caller) and GetInteractText(). Player Tick: GetPlayerCameraManager → GetCameraLocation/Rotation → LineTraceSingle(CamLoc, CamLoc + Forward*InteractDistance) → BreakHitResult → HitActor → DoesImplementInterface(BPI_Interactable) → True: show UI prompt, store as FocusedActor. Interact input → call Interact(Self) on FocusedActor.
Pattern for snapping object to ground: GetActorLocation → Add Vector(Z=+1000) → as TraceStart. GetActorLocation → Subtract Vector(Z=1000) → as TraceEnd. LineTraceByChannel(Start=TraceStart, End=TraceEnd, TraceChannel=Visibility) → Branch(ReturnValue=true) → BreakHitResult → SetActorLocation(NewLocation=ImpactPoint) → SetActorRotation(NewRotation=MakeRotFromZ(Normal)) [align to surface normal]. MakeRotFromZ takes a 'Z' input Vector and outputs Rotator aligned to that normal.
TraceChannel: ETraceTypeQuery::TraceTypeQuery1=Visibility, TraceTypeQuery2=Camera. DrawDebugType: None/ForOneFrame/ForDuration/Persistent.
LineTraceByChannelUE 5.3, 5.4, 5.5, 5.6, 5.7updated 2mo agoUKismetSystemLibrary::LineTraceSingle. WorldContextObject is hidden. End pin is world position, not direction.
Line Trace By ChannelUE 5.4, 5.7updated 2mo agoUKismetSystemLibrary::DrawDebugLine.
Draw Debug LineUE 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7updated 2mo agoMulti Line Trace By ChannelUE 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7updated 2mo agoAPlayerController method. Great for click-to-interact games.
Get Hit Result Under Cursor By ChannelUE 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7updated 2mo ago