Again i stumbled over a little function for calculating distance without the need for a sqr-call. I always thought that these little functions would be computed faster, but here's the code:
That's happening when you "optimize" your code :-)
-------------------------
www.moonworx.de
Graphics3D 800,600 pivot_01 = CreatePivot() pivot_02 = CreatePivot() starttime = MilliSecs() For i=1 To 10000 PositionEntity pivot_01, Rand(-10000,10000),0,rand(-10000,10000) dist = EntityDistanceXZ(pivot_01,pivot_02) ;dist = EntityDistance (pivot_01,pivot_02) Next Text 0,0,MilliSecs() - starttime Flip ;********************************************************************************* ;*** This calculate the 2d distance*distance on y axes ;*** ;********************************************************************************* Function EntityDistanceXZ(Entity1,Entity2) p#=EntityX(Entity2)-EntityX(Entity1) q#=EntityZ(Entity2)-EntityZ(Entity1) Return (p*p)+(q*q) End Function
That's happening when you "optimize" your code :-)
-------------------------
www.moonworx.de