This should give you a starting point. I would store the type handle in the entityname and the type instance can be easily retreived using the Object command ...
Note that by using STR$() to display the type instance you can see all the associated field values.
Hope this helps.
Note that by using STR$() to display the type instance you can see all the associated field values.
Hope this helps.
Graphics3D 640,480,16,1 Global Camera = CreateCamera() PositionEntity Camera,0,50,0 RotateEntity Camera,90,0,0 Global Highlight = CreateCube() ScaleEntity Highlight, 2, 2, 2 EntityAlpha Highlight,.5 HideEntity Highlight Const ID_NPC = 1 Const ID_Light = 2 Const ID_Container = 3 Global CURRENT.GameObject ;selected object Type GameObject Field Name$ Field Entity Field ID Field Otherstuff End Type ;set up some objects For l = 1 To 20 test.GameObject = GAMEOBJECTcreate( Rand(1,3) , Rand(-50,50), 0 , Rand(-50,50 ) ) Next While Not KeyDown(1) GAMEOBJECTpick() RenderWorld() DISPLAY() Flip Wend ;================================================= ;================================================= ;================================================= Function DISPLAY() Color 255,255,255 Oval MouseX()-5,MouseY()-5,11,11,0 Text 0,0,"Selected Object : " If CURRENT<>Null Text 0,20,Str$(CURRENT) Else Text 0,20,"Nothing" End If End Function ;================================================= ;================================================= ;================================================= Function GAMEOBJECTpick() MR = MouseDown(1) ML = MouseDown(2) If MR Or ML CameraPick( Camera , MouseX(), MouseY() ) GAMEOBJECTinteract( PickedEntity() ) End If End Function ;================================================= ;================================================= ;================================================= Function GAMEOBJECTcreate.GameObject( ID , x#, y#, z# ) g.GameObject = New GameObject g\ID = ID Select g\ID Case ID_NPC g\Name = "Non Player Character" g\Entity = CreateCube() EntityColor g\Entity,200,100,100 Case ID_Light g\Name = "Light" g\Entity = CreateCylinder() EntityColor g\Entity,100,200,100 Case ID_Container g\Name = "Container" g\Entity = CreateSphere() EntityColor g\Entity,100,100,200 End Select EntityPickMode g\Entity , 2 PositionEntity g\Entity, x, y, z NameEntity g\Entity, Handle( g ) Return g End Function ;================================================= ;================================================= ;================================================= Function GAMEOBJECTinteract( Picked ) If Picked > 0 ShowEntity Highlight PositionEntity Highlight, EntityX( picked ), EntityY( picked ), EntityZ( picked ) CURRENT = Object.GameObject( EntityName( Picked )) Select CURRENT\ID Case ID_NPC ;reaction Case ID_Light ;reaction Case ID_Container ;reaction End Select Else HideEntity Highlight CURRENT = Null EndIf End Function