CameraPick()

Blitz3D Forums/Blitz3D Programming/CameraPick()

I'm having a problem with CameraPick(). It simply will not do anything. Here is the code for the "UpdateObjects()" function, which controls the gun shooting, and the reaction to the dynamic objects:
;updates all objects and guns
Function UpdateObjects()



	;GUN UPDATE
	;gun shoot
	If MouseHit(1)
		picked = CameraPick(camera, 400, 300)
	EndIf 

	
	For o.obj = Each obj
	For pl_o.user = Each user
		
		EntityAlpha o\entity, o\alpha#
		EntityShininess o\entity, o\shininess#
		
		Select o\obj_type$
		
			Case "enemy"
			
				;enemy AI
			
			Case "car"
				
				;update car
				
			Case "crate" 
				
				;blow up crate
				If picked = o\entity 
					;e.effect = New effect
					;e\entity = CopyEntity(ex_1\entity)
					;PositionEntity e\entity, EntityX(o\entity), EntityY(o\entity), EntityZ(o\entity)
					;Emitter_Start(e\entity)
					;HideEntity e\entity
					HideEntity o\entity
					;Delete o
				EndIf 
					
			
			Case "glass"
			
				;update glass
				
			Case "weapon"
			
				;pick up weapon
				If EntityDistance(camera, o\entity) > 5
					If MouseHit(2)
						;linepick
							For w.weapon = Each weapon
								Select o\name$
									Case "pistol"
										weapon_pu = 1
									Case "laser"
										weapon_pu = 2
									Case "plasma rifle"
										weapon_pu = 3
									Case "shotgun"
										weapon_pu = 4
									Case "mp5"
										weapon_pu = 5
									Case "rocket"
										weapon_pu = 6
									Case "grenade"
										weapon_pu = 7
									Case "sniper"
										weapon_pu = 8
									Case "plasma launcher"
										weapon_pu = 9
									Case "assault rifle"
										weapon_pu = 10
								End Select
								
								If w\id = 1
									w\w_type$[1] = o\name$
								ElseIf w\id = 2
									w\w_type$[2] = o\name$
								ElseIf w\id = 3
									w\w_type$[3] = o\name$
								EndIf
							Next
					EndIf
				EndIf  
			
			Case "door"
				;open door
				If o\d_secure = True
					If door_rotation <= 90 And good_code = True And EntityDistance(camera,o\entity)<=5 And MouseHit(2)
						door_rotation = door_rotation + 1
						RotateEntity o\entity, 0, door_rotation, 0
					EndIf 
				Else
					If door_rotation <= 90 And EntityCollided(camera,DOOR_COL) And MouseHit(2)
						door_rotation = door_rotation + 1
						RotateEntity o\entity, 0, door_rotation, 0
					EndIf
				EndIf
					
			Case "keypad"
				;type in code
				If EntityDistance(camera, o\entity)<=5 And MouseHit(2)
					While good_code = False
						Color 0, 0, 100
						Rect 350, 250, 25, 25
						Locate 350, 250 
						Color 0, 0, 255 
						code$ = Input("Insert code - ")
					
						If code = right_code
							good_code = True
						EndIf
					Wend
				EndIf 
				
			Case "elevator"
				;ride elevator down
				If EntityCollided(camera, LIFT_COL) And o\y <= o\el_dest
					MoveEntity o\entity, 0, -0.5, 0
				EndIf 
					
				
			Case "oil"
				;blow up oil
				If picked = o\entity
					e.effect = New effect
					e\entity = CopyEntity(ex_1\entity)
					PositionEntity e\entity, px#, py#, pz#
					RotateEntity o\entity, 0, 0, 90
					MoveEntity o\entity, 0, 1.5, 0
					
					If EntityDistance(camera, o\entity)<=5
						p\health = p\health - 5
					EndIf 
					
				EndIf 
				
			Case "computer"
				;burn computer	
				If picked = o\entity
					f.effect = New effect
					;f\entity = CopyEntity(fire\entity)
					PositionEntity f\entity, px#, py#, pz#
					g.effect = New effect
					g\entity = CopyEntity(sparks\entity)
					PositionEntity f\entity, px#, py#, pz#
				EndIf 
					
							
		End Select 
		
			
	Next 
	Next 
		
End Function

The only problem is with the crate. It doesn't do anything - it doesn't even delete itself, if I click on it.

You aren't making anything pickable. Which is why its not working.

Oh God! It is always those tiny little things I miss!

I spent hours trying to find the problem.

Thanks GfK!

o_O