Pick an object

Blitz3D Forums/Blitz3D Beginners Area/Pick an object

Moraldi(Posted 2007) [#1]
Hi,
Suppose we have mesh A hidden by SEVERAL meshes B,C,D etc. (as we are looking them from the Camera)
Is it possible to check if mesh A has been picked by the Camera (using Mouse Screen Coordinates) without making other meshes B,C,D... 'unpickable'?

Thanks


big10p(Posted 2007) [#2]
Are you saying you want to be able to pick A, even if it's being obscured by B,C,D?

If so, you'll have to hide B,C,D before doing the pick, if you dont want to make B,C,D unpickable.

Alternatively, if you just want to pick from the centre of the screen, you could use EntityVisible(cam,A), ensuring that B,C,D haven't been set as obscurers when setting their pick mode.


Ross C(Posted 2007) [#3]
You COULD:

REPEAT
Do a pick
Get pickedX() pickedY() pickedZ()
UNTIL pickedlength > specified_distance

Basically, do a pick. If it's below a certain length, redo the pick from the picked() co-ords. That way, It keeps picking through items, until the one you want is found, or until the length of pick is too great that nothing else will be found.


Moraldi(Posted 2007) [#4]
Thanks guys. I think I will follow Ross C's solution


Ross C(Posted 2007) [#5]
Mind if it's a camerapick(), you'll need to move the camera to the picked location and redo the pick from there. Also to remember to save your cameras orginal co-ords :o)


Dreamora(Posted 2007) [#6]
Not really
You can calculate the pick direction with the first pickedxyz and the entityxyz of the camera and use linepick afterwards


Moraldi(Posted 2007) [#7]
I missed that too.
Thanks!