Weapon Collision Manager
Last updated
Was this helpful?
Last updated
Was this helpful?
The Weapon Collision Manager (AC_CollisionManager) is a component that dynamically handles collision tracing, hit detection, and damage processing for weapons. Tracing is enabled or disabled at runtime through the , ensuring collision checks occur only during specific animation frames.
It is added to the parent Weapon Item Actor class by default (B_Item_Weapon).
Initialization:
On BeginPlay
, the component:
Reads the Trace Sockets for the start and end positions of the weapon trace.
Configures Trace Radius and Trace Types.
Sets up the tracing logic but keeps it paused by default.
Animation Notify State (ANS_WeaponTrace):
ANS_WeaponTrace is used within weapon animations (e.g., attack swings) to toggle tracing:
Enable: Starts weapon tracing by unpausing the Event Tick.
Disable: Pauses weapon tracing to stop unnecessary checks.
Collision Tracing (On Event Tick):
When tracing is enabled:
Performs a Multi-Sphere Trace using the socket positions and substepping to combat framerate dependency.
If a valid target is detected, the OnActorTraced event fires, passing hit data for processing.
Damage and Effects:
The OnActorTraced
logic handles:
Damage Calculation: Uses weapon stats and modifiers (e.g., scaling, random variance).
Damage Application: Applies point damage to the hit target.
Visual Feedback: Spawns effects like blood splatters or sparks at the impact point.
Audio Feedback: Plays sound effects for weapon hits.
Debugging:
The Trace Debug Mode visualizes traces in real-time, helping developers fine-tune trace positions and radii.