Line Pick command

Blitz3D Forums/Blitz3D Programming/Line Pick command

PaulJG(Posted 2003) [#1]
I've got my mesh terrain and my camera, how do I get my camera to stay above the mesh when I'm moving it about ?.

I know I've gotta use LINEPICK.. I've made both objects poly pickable (the camera is sitting on a camera_pivot) - but how do I use the command ?.

Thanks.


Ross C(Posted 2003) [#2]
Hey, try this out. It's my first time using LinePick, but it seems to work :)

Graphics3D 800,600
SetBuffer BackBuffer()


camera=CreateCamera()
PositionEntity camera,2,5,-6
RotateEntity camera,30,0,0
light=CreateLight()


cube=CreateCube()
PositionEntity cube,5,8,5
ScaleEntity cube,0.4,0.4,0.4
EntityColor cube,100,100,255
EntityPickMode cube,1

Dim land(2,2)
For loop=0 To 1
	For loop1=0 To 1
		land(loop,loop1)=CreateSphere()
		PositionEntity land(loop,loop1),loop*5,0,loop1*5
		EntityPickMode land(loop,loop1),2,True
		ScaleEntity land(loop,loop1),4,1,4
	Next
Next

While Not KeyHit(1)
	
	LinePick ( EntityX(cube),EntityY(cube),EntityZ(cube),0,-5,0)
	PositionEntity cube,EntityX(cube),PickedY()+2,EntityZ(cube)
	
	If KeyDown(203) Then MoveEntity cube,-0.05,0,0
	If KeyDown(205) Then MoveEntity cube,0.05,0,0
	If KeyDown(200) Then MoveEntity cube,0,0,0.05
	If KeyDown(208) Then MoveEntity cube,0,0,-0.05
	
	UpdateWorld
	RenderWorld
	Text 0,0," entityy()="+PickedY()
	Flip
Wend
End



PaulJG(Posted 2003) [#3]
Thanks :) a good example.

Got it working now.