Rubberband selection

Blitz3D Forums/Blitz3D Beginners Area/Rubberband selection

BerndWill(Posted 2005) [#1]
Hi everybody,

In my 3D space game, the source selects a single ship by this portion of code: "CameraPick(camera,MouseX(),MouseY())"

But in my space game, I want to draw a rubberband around several space ships to select them all.

How can I do this rubberband selection ? How do I find out, what ships are within the rubberband ?

Thanks for help and ideas, Bernd


DJWoodgate(Posted 2005) [#2]
Easiest way is to use the mouse to draw a rectangle on screen then project the position of everything in view to the screen using cameraproject and see if it falls within this rectangle. You could allow the usual refinement of allowing the user to add or take away from the selection using the control and shift keys for instance. Show the selected items by whatever means takes your fancy. There are examples of this sort of thing on the code archives.


BerndWill(Posted 2005) [#3]
Thanks so far. Could you please point me to an example ? I have looked around, but not found something so far.

Thanks, Bernd


DJWoodgate(Posted 2005) [#4]
http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=329


BerndWill(Posted 2005) [#5]
Thank you very much !!
That is in deed what I was looking for.

Bernd