x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

https://www.youtube.com/watch?v=CQtDdi03ttA&feature=youtu.be

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,

Roald

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

Product Version: Not Selected
Tags:
more ▼

asked Apr 03 '14 at 06:03 PM in Blueprint Scripting

avatar image

brokenpoly
151 17 21 225

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Per Bone Sword Collision

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

Here's a video!

Epic wiki link https://wiki.unrealengine.com/Victory_Game#Per-Bone_Sword_Collision

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

more ▼

answered Apr 03 '14 at 06:23 PM

avatar image

Rama
10.7k 446 346 1090

avatar image brokenpoly Apr 03 '14 at 07:53 PM

Hi there & thanks for the reply!

This method seems a tad complicated for my brain, but I`ll see if I can implement it :)

avatar image 0vr May 05 '14 at 05:27 AM

A video tutorial would be mighty helpful. i saw Rama's video demonstration and it was interesting. please show me how you did that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question