Picking 'volume' intersections.

Somewhat offtopic I know…

I’ve got picking nailed down now using my own unprojection functions - I can cast rays willynilly and test for them for intersecting triangles in my low LOD models living in the view frustum. This is very nice

Obviously the next step is click-drag-selecting. Heh. I’ve got a bit stuck here. I’ve got a ‘begindrag’ ray and an ‘enddrag’ ray, from these I guess I can create a selection volume of some description.

I can live with bounding box/sphere testing against this pick volume for click dragging, it doesn’t have to be that accurate. Anyone have any tips to set me off in the right direction?


The user presses the mouse down at (x1, y1) and releases at (x2,y2). These are 2 corners, (x1, y2) and (x2, y1) are the other 2 corners to form a square. For each of the 4 sides, use the 2 vertices of that side and the viewpoint, and use these 3 points to form a plane. You will then have 4 planes that describe your volumetric selection. Assuming the normals of these planes point into the volume, you can select any object that lies totally (or partially, depending on how you want to handle partial selections) in the positive half-space of ALL FOUR planes. Any other object would not be selected.

Thinking about this, I use an algorithm to clip AABBs against the viewfrustum. Can I not use this by passing the ‘selection’ planes to it and seeing what happens.

I’m gonna try it and see. Just need some free time