Here's a small demo.
I would also suggest looking at the Draw3d library that is floating around it. It has a nice line draw function, which you could use to draw a nice bounding box.
Graphics3D 800,600,0,2 Global camera=CreateCamera() CameraZoom camera,1.6 MoveEntity camera,0,0,-90 WireFrame True ; make the bounding box cube... Global highlightcube=CreateCube() EntityFX highlightcube,1 EntityColor highlightcube,0,255,0 Global mesh ; make some objects to play with... Type obj Field entity End Type Function makeObjects() For x=1 To 10 objs.obj=New obj If Rand(1,2)=1 Then objs\entity=CreateCone() Else objs\entity=CreateSphere() EndIf EntityFX objs\entity,1 EntityPickMode objs\entity,2 PositionEntity objs\entity,Rand(-50,50),Rand(-50,50),Rand(50,50) RotateEntity objs\entity,Rand(360),Rand(360),Rand(360) EntityColor objs\entity,Rand(0,1)*255,Rand(0,1)*255,255 ; scale the mesh... its important to use scale mesh otherwise you will have problems with the mesh dimension commands scale#=Rnd(1,10) ScaleMesh objs\entity,scale,scale,scale Next End Function ; function to check if the mouse is over and object and if so move the bounding box to it and resize it... Function checkObjects() CameraPick camera,MouseX(),MouseY() If PickedEntity()<>0 Then mesh=PickedEntity() EndIf If mesh<>0 Then ShowEntity highlightcube Width# = MeshWidth( mesh ) height# = MeshHeight( mesh ) depth# = MeshDepth( mesh ) FitMesh highlightcube, -Width*.5, -Height*.5, -Depth*.5, Width, Height, Depth RotateEntity highlightcube,EntityPitch(mesh,1),EntityYaw(mesh,1),EntityRoll(mesh,1) PositionEntity highlightcube,EntityX(mesh,1),EntityY(mesh,1),EntityZ(mesh,1) Else HideEntity highlightcube EndIf End Function ; the main loop... makeObjects() While Not KeyDown(1) ; turn the objects For objs.obj=Each obj TurnEntity objs\entity,0.2,0.02,0.2 Next ; check for the mouse over and move the bounding box checkObjects() RenderWorld Flip Wend
I would also suggest looking at the Draw3d library that is floating around it. It has a nice line draw function, which you could use to draw a nice bounding box.