i got a crappy celeron 366 so i always gotta keep my code tight or my frame rate goes to pot.
The best command i found for checking collisions where an object might pass through another before you can check for collision is INTERSECT OBJECT.
u just give it a from xyz, a too xyz, and an object no. and it returns a zero if object not between two points or if the object is between the two points it returns the distance.
heres an example:
randomize timer()
sync on
sync rate 40
autocam off
hide mouse
rem make gun
make object box 11,10,20,10
position object 11,0,10,0
rem make bullits
for x=1 to 10
make object sphere x,5
position object x,0,5,0
hide object x
next x
rem make terrain
make matrix 1,1000,1000,10,10
position matrix 1,-500,0,-500
rem make targets
for x=12 to 16
make object cube x,20
position object x,rnd(1000)-500,10,rnd(1000)-500
next x
rem varibles
angle#=0
score=0
dim targethit(5)
dim bullithit(10)
do
rem delete dead objects
for x=1 to 10
if bullithit(x)=1
bullithit(x)=0
position object x,0,0,5
hide object x
for y=1 to 5
if targethit(y)=1
targethit(y)=0
position object y+11,rnd(1000)-500,10,rnd(1000)-500
endif
next y
endif
next x
rem check if bullet moved more than 1000
for x=1 to 10
if object position x(x)>1000 or object position z(x)>1000 or object position x(x)<-1000 or object position z(x)<-1000
position object x,0,5,0
hide object x
endif
next x
rem mouselook
angle#=wrapvalue(angle#+mousemovex())
yrotate object 11,angle#
position camera sin(angle#)*125,30,cos(angle#)*125
yrotate camera angle#-180
rem fire
if mouseclick()=1 and timer()>clicktimer
clicktimer=timer()+500
for x= 1 to 10
if object visible(x)=0
show object x
yrotate object x,angle#+180
exit
endif
next x
endif
rem check for collisions and move bullits
for blts=1 to 10
bullitspeed=75
objhit=0
if object visible(blts)
for objcts=12 to 16
dist=intersect object(objcts,object position x(blts),object position y(blts),object position z(blts),object position x(1)+(sin(object angle y(1))*(bullitspeed+20)),5,object position z(1)+(cos(object angle y(1))*(bullitspeed+20)))
if dist<bullitspeed and dist<>0
bullitspeed=dist
objhit=objcts
endif
next objcts
move object blts,bullitspeed
if objhit<>0
targethit(objhit-11)=1
bullithit(blts)=1
inc score,1
endif
endif
next blts
text 0,0,"Score: "+str$(score)
sync
loop
if u wanna make bullit faster then u can change speed at line 76.
This is the fastest method i found so far.