Hey All, Just wondering what fps u guy get from this intersect object function i'm writing......
Might release this on the snippet board, once i've got a few more commands. the reason i wrote this was because i noticed static line of sight will only work with
Static Objects, and i hate working with statics, they confuse me(Dont ask why).....
SO.......Please tell me what fps, and if it laged at all, it running a thousand cylcle every time i call my function, but i still seem to manage the cap(60 Fps).
-DD
Rem DD's "Intersect Object" Function-------
` May be helpful to someone......
` Just like static line of sight, but can detect non-static objects.
`Must Dim these arrays at the start of ur prog.....
Dim DD_IO_Info(3)
`DD_IO_Info(0)=Object That was intersected..
`DD_IO_Info(1)=Intersect X
`DD_IO_Info(2)=Intersect Y
`DD_IO_Info(3)=Intersect Z
autocam off
sync on
Rem Create Boxes to test the sight........
Make object cube 1,10
Make object cube 2,15
color object 1,RGB(125,205,55)
color object 2,RGB(155,105,255)
Position object 1,-25,0,0
Position object 2,25,0,10
Rem Create Obstruction to test the sight........
Make object cube 3,20
Scale object 3,120,100,120
color object 3,RGB(255,15,25)
Position object 3,0,0,0
Position camera -10,70,10
Point camera 0,0,0
Ang#=90
Do
Set cursor 1,1
obj1x#=Object Position X(1)
obj1y#=Object Position Y(1)
obj1z#=Object Position Z(1)
obj2x#=Object Position X(2)
obj2y#=Object Position Y(2)
obj2z#=Object Position Z(2)
CANSEE=DD's_Line_of_Sight(obj1x#,obj1y#,obj1z#,obj2x#,obj2y#,obj2z#,10,30,100,2000,1)
if CANSEE=1
If DD_IO_Info(0)=2 then print "You Can see the blue cube!" Else print "You Cannot see the blue cube...":Print "Intersepted At: "+STR$(DD_IO_Info(1))+","+STR$(DD_IO_Info(2))+","+STR$(DD_IO_Info(3))
endif
Ang#=Wrapvalue(Ang#)
yrotate object 1,Ang#
if upkey()=1 then move object 1,1
if rightkey()=1 then inc Ang#,3
if leftkey()=1 then dec Ang#,3
Print Screen Fps()
sync
loop
Function DD's_Line_of_Sight(StartX#,StartY#,StartZ#,EndX#,EndY#,EndZ#,SphereSize,accuracy,Cycles,Imaginaryobjnum,Obj)
Rem Clear the imagine object if exists....
If object exist(Imaginaryobjnum)=0
Make object Sphere Imaginaryobjnum,SphereSize
endif
Position object Imaginaryobjnum,StartX#,StartY#,StartZ#
REm Running a check to "Scan" for and obstructing object.......
For Check=1 to Cycles
Yes=0
NextX#=Curvevalue(EndX#,Object Position X(Imaginaryobjnum),accuracy)
NextY#=Curvevalue(EndY#,Object Position Y(Imaginaryobjnum),accuracy)
NextZ#=Curvevalue(EndZ#,Object Position Z(Imaginaryobjnum),accuracy)
Position object Imaginaryobjnum,NextX#,NextY#,NextZ#
REm If detected an obj...........
Objdetected = object collision(Imaginaryobjnum,0)
if Objdetected > 0 and Objdetected <> Obj
Yes=1
DD_IO_Info(0)=Objdetected
DD_IO_Info(1)=Object Position X(Imaginaryobjnum)
DD_IO_Info(2)=Object Position Y(Imaginaryobjnum)
DD_IO_Info(3)=Object Position Z(Imaginaryobjnum)
endif
if Yes=1 Then ExitFunction Yes
Next Check
endfunction Yes
Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!