   Sweep Selection with GL
  Sup,I was wondering how I implement ''sweep-selection'' in my GL app, like how you can drag a box over a bunch of units in an RTS? Can anyone point me in the right direction?Thanks for any help. 
  the general idea for a sweep select is that you essentially project a box into your world and grab all the units controllable by you into a selection list.  so it's like raycasting cept you're casting a box.  you can cheat nicely here by just doing something simple like pretending it's an axis aligned bounding box that you're sweeping out rather than an angled box.  you can cheat even more if your game is tile based, but i doubt that yours is.so you're essentially just using your collision detection code to collide the world objects against a non-visable box.  like i said you only "select" those items that collide with the swept volume and are also user controlled.[EDIT: ah, the other obvious thing is that you'll have to handle the mouse down and mouse up events so that you can grab the 2 projected terrain coords at which those events occurred so that you can make coords for your box]make sense?-me   [edited by - Palidine on February 16, 2004 5:56:25 PM] [edited by - Palidine on February 16, 2004 5:56:47 PM];  Hmm, I think I get it a little.... Right now I''ve got a box that''s drawn onto the screen coords with the mouse, just like in any other RTS... At first I was trying to test if an object was inside the box, but I just have to test if one of the sides of the sweep box collides with an object in the world? That sure simplifies things, hehe. I guess I should use GL''s object selection utilites, like a pick matrix or unproject? Maybe unproject the sides of the selection rect into the game world?;  RTSes don''t usually use unProject.  I believe they usually shoot down a ray when the player clicks and see if it hits something.   My Website | Everything you need to know about 3D Graphics | Google | Search the Forums;quote:Original post by Luke Philpot  RTSes don''t usually use unProject.  I believe they usually shoot down a ray when the player clicks and see if it hits something.and what would unproject do but return a point to build the ray with?;  It''s pretty incredible how difficult you can make things."ah, the other obvious thing is that you''ll have to handle the mouse down and mouse up events so that you can grab the 2 projected terrain coords at which those events occurred so that you can make coords for your box"Look, it''s a box on the screen, not some 3D box, and it shouldn''t be affected in any way by the camera, right?.Just draw your box accordind to the mouse?Use the gluProject function to get the screen coordinates of the selectable game objects and see which are inside the box.int gluProject(  GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble modelMatrix[16],const GLdouble projMatrix[16],const GLint viewport[4], GLdouble * winx,    GLdouble * winy,    GLdouble * winz   );Using things like collision detection is somewhat overkill.P.S. I''m not sure "what kind of" coordinates the function "returns", they or the mouse coordinates may need to be adjusted accordingly. ;  Sorry, I should have been clearer.  I meant GLs selection stuff  My Website | Everything you need to know about 3D Graphics | Google | Search the Forums;  gluProject(), eh? Thanks man, I''m gonna try that for sure...I''ve got the object selection working with where the mouse cursor is at with gluPickMatrix(), but getting the selection box''s sides to pick something seems to be trickier.