I've just tried adding a loop to process the nearest object to the camera. I've 500 objects (yes I know it's a lot but they are needed) with a few line to work out the distance of each object. There code works fine but the frame rate drops from around 60 - 20 fps to around 5 fps
After a bit of playing around it appears it's the loop it's self that causing the slow down. Trying a for next loop for 500 with nothing in the loop still causes the slowdown.
It must be able to process faster than this. After all there's processing power to draw a huge bsp map plus 500 objects with all the maths that goes with it and still play a mp3 while getting not bad frame rates.
Anyone else having these sort of problems?
global NearDist as float
global NearestObject as integer
function ProcessObjects
local n as integer
local dx# as float
local dy# as float
local dz# as float
local dist# as float
NearDist = 999999
NearestObject = -1
for n = 1 to 500
dx#=camera position x(0)-object position x(n)
dy#=camera position y(0)-object position y(n)
dz#=camera position z(0)-object position z(n)
dist#=abs(sqrt(abs(dx#*dx#)+abs(dy#*dy#)+abs(dz#*dz#)))
if dist#