REM *********************************************** REM Title: 3D Line REM Author: Phaelax REM Downloaded from: http://dbcc.zimnox.com/ REM *********************************************** rem use 2 planes for line, crossed like a + sign make object plain 1, 100,100 yrotate object 1, 90 fix object pivot 1 make object plain 2, 100,100 rotate object 2, 90,90,0 fix object pivot 2 make object sphere 3, 20 color object 3, rgb(0,255,0) make object sphere 4, 20 color object 4, rgb(255,0,0) position object 3,10,5,50 position object 4,100,60,250 setPlaneLine(1,10,5,50,100,60,250,5) make matrix 1, 1000,1000,20,20 sync on do gosub _Camera_Control sync loop function setPlaneLine(obj,x1,y1,z1,x2,y2,z2, thickness) dx = (x2-x1) dy = (y2-y1) dz = (z2-z1) x3 = x1 + dx/2 y3 = y1 + dy/2 z3 = z1 + dz/2 d = sqrt(dx^2 + dy^2 + dz^2) position object obj, x3,y3,z3 point object obj, x2,y2,z2 scale object obj, d, thickness,100 position object obj+1, x3,y3,z3 point object obj+1, x2,y2,z2 scale object obj+1, d, thickness,100 endfunction REM Basic First-Person camera movement _Camera_Control: if upkey()=1 cx#=newxvalue(cx#,a#,3) cz#=newzvalue(cz#,a#,3) endif if downkey()=1 cx#=newxvalue(cx#,a#,-3) cz#=newzvalue(cz#,a#,-3) endif if leftkey()=1 cx#=newxvalue(cx#,wrapvalue(a#-90.0),3.0) cz#=newzvalue(cz#,wrapvalue(a#-90.0),3.0) endif if rightkey()=1 cx#=newxvalue(cx#,wrapvalue(a#+90.0),3.0) cz#=newzvalue(cz#,wrapvalue(a#+90.0),3.0) endif a#=wrapvalue(a#+(mousemovex()/3.0)) cxa#=cxa#+(mousemovey()/3.0) if cxa#<-90.0 then cxa#=-90.0 if cxa#>90.0 then cxa#=90.0 position camera cx#,100,cz# rotate camera wrapvalue(cxa#),a#,0 RETURN