Selecting entities with mouse

Blitz3D Forums/Blitz3D Programming/Selecting entities with mouse

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here ya go...

Graphics3D 640, 480, 0, 2

cam = CreateCamera ()

cube = CreateCube ()
ball = CreateSphere ()

MoveEntity cube, -5, 0, 10
MoveEntity ball, 5, 0, 10

EntityPickMode cube, 3
EntityPickMode ball, 1

Repeat

	entity = CameraPick (cam, MouseX (), MouseY ())
	
	Select entity
		Case cube
			picked$ = "Cube!"
		Case ball
			picked$ = "Ball!"
		Default
			picked$ = "Nothing picked!"
	End Select
	
	UpdateWorld
	RenderWorld
		
	Text 20, 20, picked$
	
	Flip

Until KeyHit (1)

End