Skip to main content

Creating Hit Trails

This plugin manages it through a World Subsystem. World Subsystems can be accessed in your classes if they have a world access. Meaning if you can do any tracing normally in your class, you can create a hit-trail too. To access this subsystem get Trace Trailer Task Manager. From that subsystem you can access Create And Register Trace Task function.

Create and Register Trace Task Function

This is the function to create our traces with given settings. Once it is created we have events that we can bind to. And an output Easy Trace Trailer Task object reference.

Create And Register Trace Task Function Preview

Inputs

These inputs will control how the hit-trail will behave.

Real-World Implementation Example

Let's look at how to use these parameters in a practical combat system implementation.

UseCaseOfInputParams

Step 1: Create and Store the Task
In this Gameplay Ability example, I create the trace task and store its reference in a variable for later access (like clearing the task when the attack ends).

Step 2: Get the Mesh Component
I retrieve the weapon's Skeletal Mesh Component from the character's equipped weapon.

Step 3: Configure Section Data
The Mesh Trail Socket Data comes from weapon attributes I've pre-configured:

SocketToPrefixDataExample

Dynamic Section Mapping:
Notice I use two different SocketToPrefixData configurations. This allows different attack types to use different weapon sections, or use the same socket sections with a different tag mapping.

  • Thrust attacks → Uses "Tip" section for precise stabbing damage

  • Swing attacks → Uses "Edge" section for slashing damage

    Dynamic Section Mapping Gif

This flexibility lets you map the same physical weapon sections to different GameplayTags based on the attack type.

Task Settings Configuration:
I use consistent values for trace settings that mirror how you'd configure standard Unreal Engine traces.

Important: Trace Channel Setup
Use an Overlap Trace Channel rather than Block. Blocking traces stop at the first hit, preventing detection of multiple targets. For single-hit mechanics, manually clear the task in your OnTraceHit event instead.

ParameterTypeDescription
Target ComponentPrimitive Component Object ReferenceSkeletal or Static Mesh Component that we are going to use to do the tracing.
Mesh Per Socket Section DataEasy Trace Mesh Section StructContains the mesh component and socket section information that defines which parts of your object will be traced.
Task SettingsEasy Trace Trailer Task Settings StructureConfiguration settings that control how the trace behaves, including trace frequency, collision channels, and other parameters.
On Trace HitDelegateEvent that fires when the trace detects a hit, allowing you to handle collision responses and damage logic.
On Trace Task ClearedDelegateEvent that fires when the trace task is completed or manually cleared, useful for cleanup operations.

Data Structures Reference

This section explains the key data structures used by the Easy Trace-Trail System.

Easy Trace Shape Types (Enum)

The plugin supports three different trace shapes for hit detection:

Shape TypeDescription
Line TraceSimple line-based collision detection, fastest performance
Sphere TraceSpherical collision detection, good for projectiles or area effects
Box TraceRectangular collision detection, best for sword edges and similar weapons

Easy Trace Mesh Socket Data (Struct)

This structure defines the trace settings for individual sockets on your mesh.

PropertyTypeDescription
Socket TagGameplay TagIdentifier for the socket, used to distinguish hit results from different parts of your weapon
Trace ShapeEasy Trace Shape TypesThe collision shape to use (Line, Sphere, or Box)
Virtual Socket DistanceFloat (cm)Distance to extend the virtual socket from the actual socket location toward the next socket. Controls trace distribution and shape size
Trail WidthFloat (cm)Width of the trail (only used for Box traces)

Easy Trace Trailer Task Settings (Struct)

Main configuration structure that controls how the trace task behaves.

PropertyTypeDescription
Trace FPSFloatNumber of traces performed per second (higher = more accurate, lower = better performance)
Trace ComplexBooleanWhether to use complex collision (slower but more accurate)
Actors To IgnoreArray of ActorsList of actors that should be ignored during tracing
Only Trace Actor OnceBooleanIf true, each actor will only be hit once per task lifetime
Result Priority OrderSet of Gameplay TagsPriority order for hit results - higher priority hits are reported first
Trace ChannelTrace Type QueryWhich collision channel to trace against
InstigatorPawnOptional pawn reference for context in hit events
Instigator TagsGameplay Tag ContainerOptional tags for additional context
Debug Draw TraceDraw Debug Trace TypeWhether to visualize traces in the world for debugging
Debug Draw TimeFloatHow long (in seconds) to display debug traces

Easy Trace Mesh Section Data (Struct)

Maps socket name prefixes to their corresponding trace settings.

PropertyTypeDescription
Socket Prefix To DataMap (String → Socket Data)Maps socket prefixes (like "Edge", "Tip") to their trace configuration

Example Usage:

  • Prefix: "Edge" → All sockets starting with "Edge" (Edge_01_Start, Edge_02_End) use the same settings
  • Prefix: "Tip" → All sockets starting with "Tip" use different settings optimized for tip hits
How Virtual Socket Distribution Works

The system ensures complete coverage of your weapon sections without gaps or overflow:

Automatic Point Generation:
The plugin calculates how many virtual trace points are needed using the formula: Ceil(Section Length ÷ Virtual Socket Distance)

Even Distribution:
Instead of using your exact Virtual Socket Distance, the system divides the total section length evenly among all virtual points. This guarantees:

  • ✅ No gaps between traces
  • ✅ No trace shapes extending beyond the section boundaries
  • ✅ Consistent coverage across the entire weapon section

Performance vs. Accuracy:

  • Lower Virtual Socket Distance = More virtual points = More accurate motion tracking
  • Higher Virtual Socket Distance = Fewer virtual points = Better performance

Example: A 100cm sword edge with 15cm Virtual Socket Distance creates 7 virtual points (Ceil(100÷15)) spaced exactly 14.3cm apart.

Easy Trace Trail Hit Result (Struct)

The result structure returned when a trace detects a hit.

PropertyTypeDescription
Hit ResultHit ResultStandard Unreal Engine hit result containing impact location, normal, actor, etc.
Socket TagGameplay TagThe tag of the socket that generated this hit, allowing you to determine which part of your weapon made contact

Easy Trace Trail Socket Section Runtime Data (Struct)

Runtime data structure created automatically by the system for each trace section.

PropertyTypeDescription
Socket SectionStringRuntime-generated unique identifier for the section
Start SocketNameThe actual start socket name on the mesh component
End SocketNameThe actual end socket name on the mesh component
Section DataEasy Trace Mesh Socket DataUser-defined trace settings for this section