I am wondering if it is possible to create a way to select multiple object using a selection box? For example in strategy games you can hold and drag your mouse to draw a selection box. And everything inside the box is selected. Would it be possible to draw a box on the mouse and then for each point in the box perform a ray cast? Or is that too processing intensive?
If there is any examples of this could you please post a link?
I would get the center of each object, call cam.getScreenCoordinates() on them, and check if they are within the rectangle. Although thereβs probably some other ways
use inputManager.getCursorPosition() to get the current x/y coordinates of the mouser (do this inside of on ActionListener that listens for the mouse left button to be pushed)
the width/height of the quad would be the current values from inputManager.getCursorPostion() (that you fetch inside of your update loop while the mouse left is held down)
and the local translation of the geometry would be the cursor when you first clicked the mouse left button.
Awesome thanks. Only problem left is that My input manager is in a different class. So how can i access the gui Node in my main class from my input manager class?
before someone less nice than me answers it seems you need a bit more understanding of References in java. You can pass it as an argument to a method of your other class, or use a static getter, or what ever