Hi all,
I’ve run into an issue and I can see a number of ways to solve it, but I want to know what the ‘correct’ strategy is.
In my game, players can pick up battle hammers. This is done by means of a sphere component around the pawn overlapping with the weapon. It is then automatically equipped to the pawn.
The player can strike the ground with the hammer and deal damage to other nearby players. I want the damage radius to be quite large so I have added a large sphere component to the head of the hammer which determines the hammer’s range. Any characters overlapping the sphere are in the range. BUT, the problem I’ve got now is that now I get overlap events from the hammer from a big distance which means that the pawns pick them up from too far away.
Is it normal to have more than one collision component attached to an actor? If so, what scheme do you use for filtering out the spheres you want to ignore? Or am I approaching the whole thing from the wrong angle?
Rather than using a sphere component attached to the hammer and determining the overlap, I would have tackled this using ‘Apply Radial Damage’ or even ‘Apply Radial Damage With Falloff’ blueprint nodes with the location set to the impact location of the hammer. With the latter approach, enemies that are further away receive less damage than those nearer to the damage location (hammer impact point). Super easy to implement and you get full control of the damage area. Good luck
Ok, thanks for the answers. Taces, I’ll check out those links in detail - looks interesting.
ULLS, in the method you are talking about how do I select which players to call TakeDamage() on? Or do I just call TakeDamage() on all other players? It seems like a waste to call it on players which aren’t near.
In BP, all of this is handled for you and it will automatically send a damage event to anything inside the given area unless explicitly told to ignore it (i.e. yourself). I expect it works in a similar way in C++, the documentation is somewhat lacking though and I have yet to actually try it out so I can not confirm this.
I expect it is quite simple to use though and was clearly designed for this use case.