What is the proper way to inflict damage using sockets?
Hi guys & gals!
I am pretty new to character scripting in UE4, so I was wondering what`s the best/easiest way for my character to inflict damage onto other objects or enemies/pawns? At the moment, I got a character with a simple melee attack animation in my scene and after playing around with sockets and blueprint, this is what I got:
The player seems to be able to inflict damage to objects now, but I am pretty sure this isn`t the correct way of doing things. First of all, it only seems the damage is inflicted at the location of the socket when the animation starts, and not every frame of the animation. Secondly, I am pretty sure I shouldn`t have to make an "Event Any Damage" event for all the objects I want the damage to be applied to.
Can anyone point me in the right direction when it comes to inflicting damage, both to other pawns and preferably to destructable objects & rigid bodies as well?
All the best,
Socket on player: https://dl.dropboxusercontent.com/u/1412178/socket.JPG
Simple blueprint setup for objects taking damage: https://dl.dropboxusercontent.com/u/1412178/event_damage.JPG
Character blueprint setup: https://dl.dropboxusercontent.com/u/1412178/character_setup.JPG
Per Bone Sword Collision
I developed a per-bone sword collision system that takes animations into account.
Here's a video!
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
answered Apr 03 '14 at 06:23 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here