Download

Dark Souls Lock on System

Im trying to detect enemies through a sphere trace for objects(Like Dark Souls), and for that I do a sphere trace from the players location, and if it detects one of the enemy types I have (which are all character type) then the player should lock on a specific monster. The problem is that the pawn is not ignored, even if I set it as actors to ignore. Could anyone point me out any tips?

In your project settings in collision tab you can create new channels for trace detection and collision. So you can create a channel called monsters or something.
Then in your sphere trace by channel node, set to trace for the channel you created. Hope this helps

Somehow setting WorldDynamic fixd it for me, however I have bumped into this problem now:

Either setup the trace to detect only the sphere component of the enemy, OR use a forEach loop to populate a second array with logic for filtering unique enemies (addUnique node might help)

The problem is that in MultispheteTraceForObjects I cannot choose to only select the capsule of my enemy, plus I cannot select it as there is no way to cast to it. I have thought about making the enemies get added to an array and then select from it. Many thanks for your suggestion.

“Cast to component”: capsule pulling from the hit component pin.

I added empty interface that is named “Enemy_Interface”.
Then i split trace results, there is pi for hit actor. I check if it has “Enemy_interface”.
This way any blueprint that has that interface is processed as enemy.

You can also easily process all enemies in level by doing: “get all actors with interface”.