pickentity and find type
BlitzMax Forums/MiniB3D Module/pickentity and find type| 
 | ||
| Hi, I am trying to convert an blitz3d code to minib3d. I am familiar with b3d for some time, but I just bought bmax, and I have one problem: I want to do a camerapick with the mouse to select an entity. My problem is to find the corresponding entity's type. In b3d I used object/handle to retun my type: 
ent.scenery=pickobject()   ;ponter to type
Function pickobject.scenery()
      local temp	
      temp=CameraPick(cam,MouseX(),MouseY())
      If temp<>0
           pick.scenery=Object.scenery(EntityName(temp))   
           If pick <> Null 		
                   Return pick
           End If
      End If 
End Function 
But I am clueless about how to do the same in minib3d. I am not sure how to use HandleToObject and HandlefromObject, should I use them? The pickentity function returns a Tentity, but how do I find my respective type? Right now I am using a For...EachIn loop, but just because I couldn't do otherwise. I would appreciate any help. | 
| 
 | ||
| Well, as I couldn't find a better way. I did the following: 
Global objectlist:TList = New TList
type Tscenery
      field obj:Tentity
      field name:string
end type
If MouseHit(1)
	Local pick:Tentity= CameraPick(cam , MouseX() , MouseY() )
	Local temp:Tentity =PickedEntity()
	If temp:Tentity<>Null
		Local temp2:Tscenery
                For temp2:Tscenery=EachIn objectlist:TList
		If  temp2.obj=temp:TEntity
			'found it!
			Exit
		End If
		Next
        end if
end if
print temp2.name  
 |