Melee Weapon Damage System (MWDS) a.k.a. Static Mesh Tracing Plugin lets you trace the position of any static mesh component as it moves and see what it collides with. But isn't the default in engine collision enough? No it isn't. Non root components (attached to other objects) are never sweeped (traced), this means they do not move 'continuously', but teleport between locations. For this reason they will never trigger 'on hit' (only sweeped can do this) and they will trigger 'on overlap' unreliably (when it happens that component will teleport inside another object and not past it).
This plugin remedies this. Any component can be traced and you get robust collision info on each hit.
I’ve created it for my Hack and Slash game for white arms, but it can be used for just about any static mesh.
Explanation Video For Plugin
Example - Collision detection for boss battle like in Dark Souls
- Simplicity - The plugin is realized through the Static Melee Weapon component. It is a subclass of native Static Mesh, with added functionality to trace positions of colliders every frame. This means there is very little overhead, you work with it like with regular static meshes. See quickstart.
- Per collider precision - you not only know that collision took place, you also know which collider (by name) hit. This allows for unique behaviors. E.g. imagine a two sided spear where each end is infused with different element - fire on one side, ice on the other. In the static mesh editor you name colliders ‘fire’ and ‘ice’ respectively, then during collision you get information which one collided with the enemy so you can apply appropriate elemental damage.
- Low FPS mode - on low FPS to improve precision, additional in between traces will be added, of course you get full control over it. See trailer.
- Call Start/StopSweeping in response to your custom animation events, or add MeleeWeaponSwing anim notify to animation. MeleeWeaponSwing takes the skeletal mesh of your actor, and iterates over all child components of type StaticMeleeWeapon and calls Start/StopSweeping on them.
- Bind event to OnWeaponHit on a StaticMeleeWeapon, when event triggers it gives you Collisions array with detailed description of all collisions that took place.
- Implement IOnHitByMeleeWeapon interface on any object and override OnHitByMeleeWeapon to react for hits on this actor. Equivalently you can iterate over Collisions array and call your custom method on reported Actors.
- To change the mesh to another one, just call SetStaticMesh.