make memblock 1,1
delete memblock 1
make object cube 1, 5
position object 1, 0,0,20
setupobject 1,0,0
make object plain 2, .1,.1
color object 2,rgb(255,0,0)
setupobject 2,0,0
do
x# = camera position x()
y# = camera position y()
z# = camera position z()
xa# = camera angle x()
ya# = camera angle y()
za# = camera angle z()
nx# = newxvalue(x#,xa#,50)
ny# = newyvalue(y#,ya#,50)
nz# = newzvalue(z#,za#,50)
hit# = intersectobject(0,0,x#,y#,z#,nx#,ny#,nz#,0)
if hit# > 0 then show object 2 ; position object 2, getstaticcollisionx(),getstaticcollisiony(),getstaticcollisionz()
if hit# = 0 then hide object 2
rem Control player direction
rotate camera camera angle x(0)+(mousemovey()/2.0),camera angle y(0)+(mousemovex()/2.0),0
rem Control player movement
cx#=camera angle x(0) : cy#=camera angle y(0)
if upkey()=1 then xrotate camera 0,0 : move camera 0,0.2 : xrotate camera 0,cx#
if downkey()=1 then xrotate camera 0,0 : move camera 0,-0.2 : xrotate camera 0,cx#
if leftkey()=1 then yrotate camera 0,cy#-90 : move camera 0.2 : yrotate camera 0,cy#
if rightkey()=1 then yrotate camera 0,cy#+90 : move camera 0.2 : yrotate camera 0,cy#
if wrapvalue(camera angle x(0))>40 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,40
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
loop
im using the sparky collision dll and trying to make a laser sight (like u put ontop a gun) with this code but for some reason it is not working... i want the "laser" to start at the camera and go for i duno say 25 units and check and see if anything is inbetween... if anything is in the way then i want to position a red dot one that object... then the dot will move coressponding to the camera.
help me figure out what is wrong with my code... thanks