@Zwolejo (Zwolejo) posted a new topic, subject "Multiple selection by mouse cursor". It read:

   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 ?

Then @eXi (Cedric Neukirchen) said

    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:
    
    Unreal Engine Forums – 30 Mar 14
    
    ### Box selection of actors
    
    I'm planing to create a small game where the player can select created units (actors) on the map through the cursor/finger. Actually exactly like in games like Age of Empire etc. What I currently have is only the visual “box” in the user interface....
    
    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 (:

After which, @Zwolejo (Zwolejo) added

    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?

Then @eXi (Cedric Neukirchen) said

    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 (:

To which @Zwolejo (Zwolejo) replied

    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.

Then @eXi (Cedric Neukirchen) said

    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.

Then @Zwolejo (Zwolejo) said

    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 ?

@eXi (Cedric Neukirchen) replied

    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.


{'source': 'discourse', 'url': 'https://forums.unrealengine.com/t/multiple-selection-by-mouse-cursor/302481', 'title': 'Multiple selection by mouse cursor', 'views': 1956, 'has_accepted_answer': True, 'word_count': 477, 'like_count': 0, 'reply_count': 7, 'participant_count': 2, 'posts': 8, 'tags': 'question Blueprint mouse-cursor multiple', 'author': '@Zwolejo (Zwolejo)', 'participants': '@Zwolejo (Zwolejo), @eXi (Cedric Neukirchen)', 'image_url': [None], 'created_at': '2014-12-26T12:22:14.000Z', 'last_posted_at': '2014-12-27T22:43:59.000Z'}