Clickable objects
Blitz3D Forums/Blitz3D Tutorials/Clickable objects| 
 | ||
| Hello, I was wondering how you would go about making some like say.. a door. If you click on the door it does something. I'am not sure how to make it clickable. Any help would be much appreciated. | 
| 
 | ||
| I realize I posted this in the wrong place. My apologizes. | 
| 
 | ||
| The Blitz3D Beginners Area forum is more appropriate for this kind of questions. You want to use a combination of EntityPickMode() and CameraPick() or LinePick(). EntityPickMode() is used to make a mesh "pickable". CameraPick or LinePick is used to throw a ray from a point and then you can retrieve the picked "pickable" pointer, and infos about the pick (x,y,z,nx,ny,nz) Preferably, you want to use a low tris mesh for each "pickable", or EntityRadius or EntityBox. | 
| 
 | ||
| I've messed with those, but I'm having trouble trying to actually tie it to a  keypress. | 
| 
 | ||
| You could try something like this(pseudo code): 
If KeyDown(28)=True and distance_to_object<door_range or collided_with_doorobject=true then
    MoveEntity Door, Xunits, 0,0
Endif
Where of course the enter key is being used to open the sliding door. | 
| 
 | ||
| This has got me stumped. Blitz3d is the first language I've actually sit down and actually put effort into learning. So bare with me if I don't quite understand something. Thanks for the help I am getting. I really appreciate it. Function Jail()													   ; Starting zone
	Cls 
	started = True                                                 ;Room
	PlayerData()
	FreeImage (start_btn)
	Cls 
	PlaySound(Jailsound)
	Jail = LoadMesh("Media\Meshes\Jail\Jail.b3d")
	PositionEntity(Jail,0,0,0)
	ScaleEntity(Jail,1.2,1.2,1.2)
	EntityType Jail, Type_Jail 
	
	
	box = CreateCube()                                             ; Clickable Test subject
	EntityPickMode box,2
	x = 0
	z = 5
	PositionEntity box,x,0,z
	ScaleEntity box,20,20,20
	
	If MouseHit(2) Then CameraPick(cam,MouseX(),MouseZ())
		
	
End Function | 
| 
 | ||
| Perhaps this is something: Code archives/3D Graphics - Mesh/Doors 101 - Simple multiple door system |