CollisionBox for target selection within a certain radius?
The player should be able to select/switch throught targets near his character. e.g.: Player presses "TAB" and he will select the nearest target within a special radius around his character, without any height limit. So even if the the would be 10km above the target, if he is within this radius around his character he will be able to select the enemy.
Is a collision box the right approach for this?
asked Jun 11 '15 at 06:48 PM in C++ Programming
If your player needs to get a single Actor above him a trace would suffice. You could easily just run a trace above your player and use the
(Posting this as an answer as comments cannot accept all my text...)
This question is posted in C++ so I assume op might be looking for a code solution as well as Blueprints.
I would implement it slightly differently in any case - according to op's specific requirements (Z axis difference should not affect the output), I would suggest implementing an interface on all targetable objects, and then to use an actor (or object) iterator to find the relevant targetable objects. Using an interface would speed up this query significantly.
After getting the list of targetable objects, you want to find the distance from the player to each of these, ignoring the Z component. This can be done as follows (I'm assuming the objects are actors for simplicity's sake):
answered Jun 12 '15 at 10:24 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here