Multiple selection by mouse cursor

I wonder how to make multiple selection by cursor. I ve made simple line trace which alows me to select single object,(anyway I am using mouse overlap events instead). Now I am trying to make some sort of box using mouse which allow me to select few units on map, I were trying smth with muli box trace but i dont know how to convert my camera location and cursor location for parameters to this function. Any solutions ?

Hey, look at the Answer of this Question. He gave a pretty good example on how to achieve this.

He converst the 3D Space to 2D and checks if the positions are inside the retangle. You can see all his Blueprints and a small Code snippet for the test in his answer:

If you don’t want to code, you can make his C++ function in Blueprints too. Just some branches that check if a number is higher or lower than another.

If you need help, just ask me (:

Hey, thx for reply. It looks pretty difficult. I ll try to achieve it only with blueprint, be cause my license for visual has expired … Anyway, didnt they made it open source with .NET?

Visual Studio shouldn’t be off for you. The 2013 Version is free to you as a UE4 Subscription Member or not? :X

It’s not that difficult. Most of it is Blueprint already and you just need to check the C++ code and “convert” it into Blueprint.

Just make a Function in your Hud Blueprint and call it

“is2DVectorInRectangle”. Give it 3 Inputs. All 3 should be Vector2D. Then you create 2 Variables call min and max or something like that that are also Vector2D. The rest can be seen in the C++ Code. As you see, C++ is nearly the same as Blueprinting (:

I downloaded some trial version of visual. Now I am trying to find some key for visual at my unreal engine account, but i dont see any option for that. Maybe student license dont allow visual studio.

No, normaly is should be available for you. Please contact the Epic Games Staff (keep in mind it’s winter holidays) and ask why you can’t use VS anymore.

One more question, maybe you know is there any problems for for each loop when array is empty? I saw many people before for each loop checking if array is not empty, why ?

Yes. Imagine you want to use something from the array element. Like the actor location. If there is no actor, you will get an error. Maybe it won’t start the for each if the array is empty, but it is a gopd practice to always make sure that you are not trying to work with a null pointer.