Selecting multiple objects using mouse

Hi,



I am wondering what would be best way to implement area selection in JME3. I would like to implement a selection rectangle, just like in windows desktop (or from games you might know Command and Conquer 3 and how objects are selected). That is, I would like to have mouse click&drag to draw a rectangle and then have all objects selected from inside of the rectangle.



For that I need to:


  1. Draw and update rectangle borders (according to mouse).
  2. Know what objects are inside of the rectangle.



    Are there some out of the box features in JME3 that would implement what I want?



    Thanks

Create your custom control and use it in your application. In SDK source code, there are some examples, look at the SDK AbstractCameraController.java and see how it is handled in SceneApplication.

Have a huge plane ( a quad) in the scene with size 1000 x 1000.

Perform raycasting 2 times :

a) on mouse press.

b) on mouse release.



Only the plane is collidable.



Create a box from (mousePress, mouseRelease), everything inside the box is selected.

Its a pyramid (feel like I’m quoting Aliens vs Predator xD)

Thanks for answers. I think I have now pretty good idea how to start writing area selector. However, I still have one question. How can I draw rectangle (borders)?

For appearance :

  1. wireless box
  2. transparent box with texture with alpha.