Here's a LinePick example. Put it in the same folder as the CameraPick example. Seems to suggest everything is working OK (including CreateOctree):
Import "../MiniB3D.bmx"
Local width=640,height=480,depth=16,mode=0
Graphics3D width,height,depth,mode
Local cam=CreateCamera()
PositionEntity cam,0,0,-15
Local light=CreateLight()
RotateEntity light,45,0,0
Local marker_a=CreateSphere()
ScaleEntity marker_a,0.2,0.2,0.2
EntityColor marker_a,255,255,0
PositionEntity marker_a,-14,0,0
Local marker_b=CreateSphere()
ScaleEntity marker_b,0.2,0.2,0.2
EntityColor marker_b,255,0,0
Local sphere=CreateSphere()
EntityRadius sphere,1
EntityPickMode sphere,1
PositionEntity sphere,-10,5,0
Local mesh=LoadMesh("media/teapot.b3d")
EntityPickMode mesh,2
ScaleEntity mesh,4,4,4
Local octree=CreateOctree(mesh,0,3)
Local box=CreateCube()
FitMesh box,-2,-1,-1,4,2,2
EntityBox box,-2,-1,-1,4,2,2
EntityPickMode box,3
PositionEntity box,10,-5,0
Local sphere_move_y#=0.1
Local mesh_move_y#=0.1
Local box_move_y#=0.1
;' used by camera code
Local mxs#=0
Local mys#=0
Local move#=0.5
MouseXSpeed() ;' flush
MouseYSpeed() ;' flush
;' used by fps code
Local old_ms=MilliSecs()
Local renders
Local fps
While Not KeyDown(KEY_ESCAPE)
If KeyHit(KEY_ENTER) Then DebugStop
;'' control camera
;' mouse look
If KeyDown(KEY_SPACE)=False
mxs#=mxs#+(MouseXSpeed()/5.0)
mys#=mys#+(MouseYSpeed()/5.0)
RotateEntity cam,mys#,-mxs#,0
MoveMouse width/2,height/2
EndIf
MouseXSpeed() ;' flush
MouseYSpeed() ;' flush
;' move camera forwards/backwards/left/right with cursor keys
If KeyDown(KEY_UP)=True Then MoveEntity cam,0,0,move# ;' move camera forward
If KeyDown(KEY_DOWN)=True Then MoveEntity cam,0,0,-move# ;' move camera back
If KeyDown(KEY_LEFT)=True Then MoveEntity cam,-move#,0,0 ;' move camera left
If KeyDown(KEY_RIGHT)=True Then MoveEntity cam,move#,0,0 ;' move camera right
;''
' move objects up and down
MoveEntity sphere,0,sphere_move_y#,0
MoveEntity mesh,0,mesh_move_y#,0
MoveEntity box,0,box_move_y#,0
' turn mesh
TurnEntity mesh,0,1,0
' switch y direction of object if too high/low
If Abs(EntityY#(sphere))>10 Then sphere_move_y#=-sphere_move_y#
If Abs(EntityY#(mesh))>10 Then mesh_move_y#=-mesh_move_y#
If Abs(EntityY#(box))>10 Then box_move_y#=-box_move_y#
;' if mousehit then perform linepick
If MouseHit(1)
;' reset entity colors
EntityColor sphere,255,255,255
EntityColor mesh,255,255,255
EntityColor box,255,255,255
Local pick=LinePick(EntityX(marker_a),EntityY(marker_a),EntityZ(marker_a),100,0,0)
Local pe=PickedEntity()
Local ps=PickedSurface()
If pick<>0
DebugLog "Picked!"
DebugLog "PickedX(): "+PickedX()
DebugLog "PickedY(): "+PickedY()
DebugLog "PickedZ(): "+PickedZ()
DebugLog "PickedNX(): "+PickedNX()
DebugLog "PickedNY(): "+PickedNY()
DebugLog "PickedNZ(): "+PickedNZ()
DebugLog "PickedTime(): "+PickedTime()
DebugLog "PickedEntity(): "+pe
DebugLog "PickedSurface(): "+ps
DebugLog "PickedTriangle(): "+PickedTriangle()
EntityColor PickedEntity(),255,255,0
PositionEntity marker_b,PickedX(),PickedY(),PickedZ()
Else
DebugLog "Not Picked"
EndIf
EndIf
RenderWorld
renders=renders+1
;' calculate fps
If MilliSecs()-old_ms>=1000
old_ms=MilliSecs()
fps=renders
renders=0
EndIf
Text 0,0,"FPS: "+fps
Text 0,20,"Click left mouse button to perform line pick"
Text 0,40,"LinePick will be performed from yellow marker towards the right"
Text 0,60,"Object will turn yellow when picked, and a red marker while show pick point"
Flip
Wend
End