Collision Detection for bullets

Blitz3D Forums/Blitz3D Beginners Area/Collision Detection for bullets

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.

heres some an example thats completely done using camerapick

Graphics3D 800,600,16,2 ;set up graphics

;create a box to shoot
Local box = CreateCube()
PositionEntity box,0,0,5
EntityPickMode box,2 ;set its pick geo

;create a camera
Local cam = CreateCamera() 

HidePointer(); hide the mouse
While Not KeyHit(1)
	
	If MouseHit(1) Then 
		If CameraPick(cam,MouseX(),MouseY()) = box Then ;check if the user shot the box
			Text 400,300,"YOU SHOT THE BOX"
			Flip
			Delay 1000
		Else
			Text 400,300,"YOU MISSED THE BOX"
			Flip
			Delay 1000
		EndIf
	EndIf 
	
	;update and render stuff
	UpdateWorld()
	RenderWorld()
	
	;draw a pointer
	Oval MouseX()-6,MouseY()-6,12,12,False
	Line MouseX(),MouseY()-7,MouseX(),MouseY()+7
	Line MouseX()-7,MouseY(),MouseX()+7,MouseY()
	
	Flip
Wend