. .

Blitz3D Forums/Blitz3D Beginners Area/. .

Link(Posted 2008) [#1]
is there a way to make a 2d image (e.g. a cursor) and use it to "click" on a 3d object, such as a cube?


Matty(Posted 2008) [#2]
Look at the camerapick commands in the command reference, passing it the camera, mouse x() and mouse y() values, make sure the object you wish to select is pickable with per polygon picking specified.


Link(Posted 2008) [#3]
could you show me an exmple? ive never tried this before.
would this be right?



Matty(Posted 2008) [#4]
close but not quite right...don't have b3d in front of me right now but it should go something like this:

graphics3d 800,600,0,2
camera=createcamera()

cube=createcube()
entitypickmode cube,2 ;sets per polygon picking

moveentity camera,0,0,-10 ;move the camera back so it can see the cube

repeat

mx=mousex()
my=mousey()
updateworld
renderworld

if camerapick(camera,mx,my)<>0 then 
color 255,255,255
text 0,0,"You put the mouse cursor over the cube"
else
color 255,255,255
text 0,0,"Mouse cursor not over anything"
endif 
flip
until keydown(1)
end




something like that should work


Link(Posted 2008) [#5]
wow your good. spot on! txs ^^