PickedEntity seems not constant, help
Blitz3D Forums/Blitz3D Programming/PickedEntity seems not constant, help
| ||
Hi there, i use pickedEntity with CameraPick for loading somes objets in the scene on mouse clic. I use transparents cube and PickedEntity retrieve a number which i use to determine which object is picked. My problem is that this number change if i change the computer, i could have for example 23270744 in one computer and 36480223 in the other, so taht the program don't work. What the good methode for me, is it possible to get the name of the picked object ? Thank's |
| ||
It is very common that these numbers are different. How were the objects created ? When they are loaded/created, the instruction that loads/creates returns this number (handle) of the created object: x = CreateCube() print x |
| ||
The object is made in 3D apps, which is more practice for positioning, then exported in direct X, then load in the scene with alpha set to transparent. If it's common that these numbers are different, what methode should i use to determine which object is picked ? |
| ||
Try this Fast Entity Find code. |
| ||
If you don't need to know anything other than the objects name then there is no need to store a type handle there, simply store the name of the object type .. Somethig like ... global Building = Loadmesh("Building.B3d" ) : nameentity Building, "Building" ..... Camerapick ( Camera, mousex(), mousey() ) If PickedEntity() > 0 Type_Of_Entity_Selected$ = EntityName( PickedEntity() ) Endif Stevie |
| ||
Thank's stevie, your code works perfectly and is very simple. Thank's a lot |
| ||
this also works: global Building = Loadmesh("Building.B3d" ) ..... Camerapick ( Camera, mousex(), mousey() ) If PickedEntity() =building runtimeerror "you picked the building" Endif just in case you didnt know... |