Get actors in selection rectangle, selecting actors behind.

Get actors in selection rectangle is also selecting actors directly behind the camera. Is it always like that, if so, how do I only select those in front of the camera.

I want to put a HUD drawing like a draw rect in the actors location but if I look behind and the actors are directly behind the camera, the HUD will also draw to those actors.

I have the same problem. Is there any workaround other than using a Box Trace?

It’s probably caused by components expanding your pawn’s/character’s bounding box to beyond what you’d expect. See my answer to https://answers.unrealengine.com/questions/85782/get-actors-in-selection-rectangle-doesnt-work.html for a possible solution in c++.

hi friends. I see a lot of time has been passed after this question and still there was no ansver. But i found it. Let me explain all step by step.

First we need to deal with character’s bounding box. If our character has this setup, for example, look:

in this case my bounding box will be like blue line. And if i spawn multiple npc’s with this layout their bounding boxes will be that big as well. What we need? We need to limit bounding box size only with Mesh component. (and capsule component as well). So how we can achieve that? There is parameter named - use attach parent bound. If we will set it to True - actor component will inherit bounds from parent and will not generate it’s own bounds at all. So we can do this for each character component on Begin Play:

Will this fix our problem? Not in all situations. Mostly it will be fixed, but if you will put your character close to other characters “get actors in selection rectangle” will still select behind characters as well.
So we need to filter them off. How ne can know if character is behind player? I don’t certainly know but… this construction works in my case:

it’s ofc can be normalized but it works this way anyway.
So what i do? After “get actors in selection rectangle” i just take call function Select Actors that has filter inside it.

I hope this will helps someone.

Do you have an Idea, how can I fix the actor blueprint scale in a bound box, I have multiple cutouts in wall of house, and I’m trying to spawn doors in that cutouts, but the issue is width of some doors are larger some are small, but all have same scale 1, I can’t get the solution how to fix the door size according to cutout