I have found out, that function
Length Vector3 (Vector2), is more faster than standard function of distance between two objects
Sqrt ((SourcePoint
estPointX) ^2 + ((SourcePointY-DestPointY) ^2 + ((SourcePointZ-DestPointZ) ^2). The following code shows it.
+ Code Snippetr=Make Vector3(1)
Make Object Cube 1, 1
Position Object 1, Rnd(20), Rnd(20), Rnd(20)
Make Object Cube 2, 1
Position Object 2, Rnd(20), Rnd(20), Rnd(20)
Sync Rate 0
Sync On
Position Camera 0, 10, -50
x1#=Object Position X(1)
y1#=Object Position Y(1)
z1#=Object Position Z(1)
x2#=Object Position X(2)
y2#=Object Position Y(2)
z2#=Object Position Z(1)
Do
Timer1=Timer()
For i=1 To 100000
dist1#=Sqrt((x1#-x2#)*(x1#-x2#)+(y1#-y2#)*(y1#-y2#)+(z1#-z2#)*(z1#-z2#))
`dist1#=Sqrt((x1#-x2#)^2+(y1#-y2#)^2+(z1#-z2#)^2)
Next i
Timer1=Timer()-Timer1
Timer2=Timer()
For i=1 To 100000
Set Vector3 1,(x1#-x2#),(y1#-y2#),(z1#-z2#)
dist2#=Length Vector3(1)
Next i
Timer2=Timer()-Timer2
Text 10, 10, "FPS = "+Str$(Screen FPS())
Text 10, 30, "Distance (Sqrt()) = "+Str$(dist1#)+" Time = "+Str$(Timer1)
Text 10, 50, "Distance (Length Vector3)) = "+Str$(dist2#)+" Time = "+Str$(Timer2)
Sync
Loop