# What is the proper way to inflict damage using sockets?

**URL:** <https://forums.unrealengine.com/t/what-is-the-proper-way-to-inflict-damage-using-sockets/279562>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 3, 2014, 6:03pm UTC](https://forums.unrealengine.com/t/what-is-the-proper-way-to-inflict-damage-using-sockets/279562 "2014-04-03T18:03:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [April 3, 2014, 6:23pm UTC](https://forums.unrealengine.com/t/what-is-the-proper-way-to-inflict-damage-using-sockets/279562/2 "2014-04-03T18:23:35Z")

</div>

#Per Bone Sword Collision

I developed a per-bone sword collision system that takes animations into account.

Here’s a video!

Epic wiki link

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

#Summary

you need do simple traces to identify which actor is in front of the weapon

then do a component level trace (see primitivecomponent.h) against the mesh of the character that is found in front of player

you need to do the traces from the weapon in the direction it is moving. Calculate the socket’s normalized velocity (direction) by getting the prev and current socket position

make several sockets along the length of the weapon and trace in the direction the sword is moving

all the above traces are simple

only once you have detected a character in front of sword do you switch to component trace

and you should only do the component trace from the 1 socket where the simple trace connected

multiple component traces can get expensive

Enjoy!

Rama

---

_[View the full topic](https://forums.unrealengine.com/t/what-is-the-proper-way-to-inflict-damage-using-sockets/279562)._
