How slow is this function

Blitz3D Forums/Blitz3D Programming/How slow is this function

Changed it a little bit. Ok, LinePick doesn't seem to be working at all. What am I doing wrong? My homemade check function LinePick2 does return what I want, but it's slow as heck. Linepikc doesn't seem to be returning anything.
Keys:
1 - home made check
2 - linepick
3 - linepick with start and destination coords

Graphics3D 640, 480, 0, 2
AppTitle "test"

cam = CreateCamera()
MoveEntity cam, 0, 0, -20


c = CreateCube()
MoveEntity c, -5, 0, 0
EntityType c, 2

c2 = CreateCube()
MoveEntity c2, 5, 0, 0
EntityType c2, 2


w = CreateCube()
EntityType w, 4
EntityPickMode w, 1

Collisions 2, 4, 2, 1
ot = MilliSecs()

checks = 1000

Repeat
	If KeyHit(2) Then
		ot = MilliSecs()
		For i = 1 To checks
			r = LinePick2(c, c2)
		Next
		nt = MilliSecs()-ot
	EndIf
	
	If KeyHit(3) Then
		ot = MilliSecs()
		For i = 1 To checks
			LinePick(-5, 0, 0, 10, 0, 0)
			r = PickedEntity()
		Next
		nt = MilliSecs()-ot
	EndIf
	
	If KeyHit(4) Then
		ot = MilliSecs()
		sx#=EntityX(c)
		sy#=EntityY(c)
		sz#=EntityZ(c)
		
		dx#=EntityX(c2)
		dy#=EntityY(c2)
		dz#=EntityZ(c2)
		For i = 1 To checks
			Line_Pick(sx#,sy#,sz#,dx#,dy#,dz#)
			r = PickedEntity()
		Next
		nt = MilliSecs()-ot
	EndIf
	
	
	UpdateWorld()
	RenderWorld
	Text 0, 0, ot
	Text 0, 20, "took: " + nt + " |r: " + r
	Text 0, 40, MilliSecs()
	Flip 0
Until KeyHit(1)
End

Function LinePick2(mesh1, mesh2, Typ = 2, Typ2=4, radius# = 1, dfm2=1)
	p = CreatePivot()
	EntityType p, Typ
	PositionEntity p, EntityX(mesh1), EntityY(mesh1), EntityZ(mesh1)
	PointEntity p, mesh2
	Repeat
		MoveEntity p, 0, 0, 1
		r = EntityCollided(p,Typ2)
		UpdateWorld
		If r <> 0 Then Exit
		If EntityDistance(p, mesh2) <=dfm2 Then Exit
	Forever
	FreeEntity p
	Return r
End Function


Function Line_Pick(sx#,sy#,sz#,dx#,dy#,dz#, radius#=1)
	Return (LinePick(sx,sy,sz,sx-dx,sy-dy,sz-dz, radius#))
End Function


=> to enable picking, you must set yours entitys's pickmode true with the 'EntityPickMode' command ! else, you'll never pick anything ...

haha, in this example I forgot to throw that in. I'll fix it.

I got all of them working, and one of the linepick functions was wrong too.

you talk about this one ?
Line_Pick(sx#,sy#,sz#,dx#,dy#,dz#, radius#=1)

if so, maybe the correction i gave was right ? ;)
( I like to be congratulated xD )

no, the code inside that function was wrong.

It's not:
Return (LinePick(sx,sy,sz,sx-dx,sy-dy,sz-dz, radius#))
It's:
Return (LinePick(sx,sy,sz,dx-sx,dy-sy,dz-sz, radius#))

Yes, of course, that's what i say ;)
=> referring to your other topic !