Selecting vertices in a mesh


Sorry if this is an easy thing to do but I want to use the mouse to select an area of a mesh. I've got the mouse picking stuff done already and it works fine, basically I can get the triangle that intersects a ray (fired from the mouses location on screen), but what I need to do is get all of the triangles within a specific area centered at the intersection point. So any Vector3f that is inside the selection area (which is moved around using the mouse) is returned. Is there any simple way of doing this? Perhaps using the collision system?


Sounds like you are making a world editor and are trying to implement a selection rectangle in this case of a fixed size.  You might want to use a Quad or Box of your selection size centered at the location of your ray pick to find the other triangles.  So for instance,

CollisionResults cr = new TriangleCollisionResults();

This may not be the optimal solution, but I think it will work.

You can convert from world to screen coordinates pretty easily using DisplaySystem.getScreenCoords().

Depending on the complexity of your scene or mesh, this could either be a a good solution or a bad one :slight_smile: