how to select entitys with a rectangle ..

Blitz3D Forums/Blitz3D Beginners Area/how to select entitys with a rectangle ..

Panno(Posted 2009) [#1]
hi,

i have a terrain with some entitys on , now i will select a group from the entitys with the mouse . for a single entity i have entitypicked mode on but

how can i select the entitys with a 2d rectangle as range , ok i must transform the mousecoordinates to 3d but have anybody a cool solutions ?

mfg panno


Matty(Posted 2009) [#2]
There are a number of ways of doing this.

One method (pseudocode):

Loop through each entity:
Cameraproject the 3d coords of the entity into 2d screen space
If projectedx/y is within bounds of rectangle then do a camerapick to the entity and check if it is obscured by the terrain, if so then don't add it to the list as it is behind a mountain or something, if it is not obscured then add it to the list of entities being selected.


_PJ_(Posted 2009) [#3]
This might help:

http://www.blitzbasic.com/codearcs/codearcs.php?code=729