Weapon Projectile Trace is an alternative to the Weapon Projectile class. It is much simpler. There are no physics calculations for gravity, velocity, or friction. The result is immediate unless you enable asynchronous tracing. In that case, the result will be available on the next frame. In a future update, Weapon Projectile Trace will support ricochets and surface penetration. You should use this class if you want a more arcade-style, instantaneous projectile system or for performance reasons.
HOW TO CREATE? #
From the content browser, use the context menu (right-click) to select Weapon Projectile Trace from the Projectile sub-category in Weapon Designer category.
HOW TO USE? #
- Select trace parameters.
- Select the damage type class.
- Use Weapon Ranged class or Weapon Designer Subsystem to spawn an instance.
ASYNC #
You can enable asynchronous tracing to take some of the load off the game thread. The tracing will run on the physics or worker thread. The direct consequence is that the test results will be available in the next frame because the result data must be retrieved on the game thread. Depending on your usage, this can affect performance and latency of your game.
MULTI #
By default, the projectile returns the first object it hits. You must therefore override the On Tracing Hit function; however, if you enable this setting, the projectile will return all the objects it has hit. You will therefore need to override the On Tracing Hits function.
TRACER #
The Weapon Projectile Trace class includes a fairly simple tracer system that allows you to see a projectile’s trajectory. It works very well but does not support trajectory changes (ricochets, crossings, etc.). The Weapon Projectile Trace class modifies the values of two variables:
- User.Trigger: This is a boolean that indicates when the effect should be activated.
- User.ImpactPositions: This is a vector array that allows you to define the positions of the impact points.
As for the Niagara system, you can study the NS_ProjectileTrace asset in the example included with the plugin
POOLING SYSTEM #
If this projectile is created using the Weapon subsystem, it automatically uses the pooling system. This system helps optimize in-game performance and memory usage. More info about Pooling System here.
EVENT #
- On Tracing Hit: Called when the projectile hits something along its path.
- On Tracing Hits: Called when the projectile hits something along its path. Returns all objects hit. Is called only when the bMulti parameter is enabled.
- On Tracing Hit Nothing: Called if the projectile did not hit anything along its path.
