Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Faster command/method than Intersect Object??

Status
Not open for further replies.

bdmangum

Technical User
Dec 6, 2006
171
US
The command intersect object is too slow for my code. I'm attempting to build a collision function which checks all surrounding areas for a collision. If I set the cameraY position to a fix number then the code is fast enough, however when I attempt to loop through the Y position my FPS drops to almost nothing.

Basically I need another command/method than Intersect Object. Intersect Object is too slow to be looped roughly 75 times per sync.

Here's the segment code:

Code:
   for x=0 to checks-1
      chx#=newxvalue(cx#,x*angwidth,100)
      chz#=newzvalue(cz#,x*angwidth,100)
      ang#(x,1)=-10000  `So first tempang# is less than ang#
      for chy#=cy#-150 to cy# step 2
         tempang#=intersect object(currentCollisionObject,cx#,chy#,cz#,chx#,chy#,chz#)
         if tempang# < ang#(x,1)
            ang#(x,1) = tempang#
         endif
      next chy#
      if ang#(x,1)=0 then ang#(x,1)=999999
      ang#(x,2)=x*angwidth
      sort#(x,1)=ang#(x,1)
      sort#(x,2)=ang#(x,2)
   next x

TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top