Not sure but doubt animated models will work as the function relies on the mesh geom being pickable.
This slight modification will work with non-pickable meshes but is not as accurate as you can see ...
An alterative would be to create a cube or sphere, scale it for an approximate fit to your mesh , set entityalpha to 0, set pickmode to 2 and parent your animated mesh to this cube.
Stevie
This slight modification will work with non-pickable meshes but is not as accurate as you can see ...
Function LineOfSight3D(observer,target,viewrange#=10.0,viewangle# = 90.0) ;distance between observer and target Local dist# = EntityDistance(observer,target) ;check if the target is within viewrange If dist<=viewrange ;observer vector TFormVector 0,0,1,observer,0 Local ox# = TFormedX() Local oy# = TFormedY() Local oz# = TFormedZ() ;pick vector Local dx# = (EntityX(target,True)-EntityX(observer,True))/dist# Local dy# = (EntityY(target,True)-EntityY(observer,True))/dist# Local dz# = (EntityZ(target,True)-EntityZ(observer,True))/dist# ;dot product Local dot# = ox*dx + oy*dy + oz*dz ;check if the target is within the viewangle If dot => Cos(viewangle/2.0) ; check if something is blocking the view Picked = LinePick(EntityX(observer,True),EntityY(observer,True),EntityZ(observer,True),dx*dist,dy*dist,dz*distance,0.01) If PickedTime() < 1.0 Return True EndIf ; If LinePick(EntityX(observer,True),EntityY(observer,True),EntityZ(observer,True),dx*viewrange,dy*viewrange,dz*viewrange,0.01)=target ; ; observer can see target ; Return True ; End If End If End If ; observer cannot see target Return False End Function
An alterative would be to create a cube or sphere, scale it for an approximate fit to your mesh , set entityalpha to 0, set pickmode to 2 and parent your animated mesh to this cube.
Stevie