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
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