Graphics(640,360,32,2)RootX# = 0 : RootY# = 0 : RootZ# = 0RootNX# = 0 : RootNY# = 0 : RootNZ# = 1.0PointX# = 0.5 : PointY# = 0 : PointZ# = 1.5FOV# = 3.141592/4 ;(45=180/4)Length# = Sqr( ( ( PointX - RootX ) * ( PointX - RootX ) ) + ( ( PointY - RootY ) * ( PointY - RootY ) ) + ( ( PointZ - RootZ ) * ( PointZ - RootZ ) ) )VecX# = PointX-RootX : VecY# = PointY-RootY : VecZ# = PointZ-RootZVecNX# = VecX/Length : VecNY# = VecY/Length : VecNZ# = VecZ/LengthDP# = ( ( RootNX * VecNX ) + ( RootNY * VecNY ) + ( RootNZ * VecNZ ) )DebugLog(DP)C# = Cos(FOV/2) ;or ACos(FOV/2)DebugLog(C)If( DP >= C ) ;point is inside cone DebugLog("is inside")Else If( DP < C ) ;point is outside cone DebugLog("is outside")EndIWaitKey()End()

I have found this :http://nic-gamedev.blogspot.fr/2011/11/using-vector-mathematics-and-bit-of.htmlthat i have converted to this (bb) code :Code: [Select]Graphics(640,360,32,2)RootX# = 0 : RootY# = 0 : RootZ# = 0RootNX# = 0 : RootNY# = 0 : RootNZ# = 1.0PointX# = 0.5 : PointY# = 0 : PointZ# = 1.5FOV# = 3.141592/4 ;(45=180/4)Length# = Sqr( ( ( PointX - RootX ) * ( PointX - RootX ) ) + ( ( PointY - RootY ) * ( PointY - RootY ) ) + ( ( PointZ - RootZ ) * ( PointZ - RootZ ) ) )VecX# = PointX-RootX : VecY# = PointY-RootY : VecZ# = PointZ-RootZVecNX# = VecX/Length : VecNY# = VecY/Length : VecNZ# = VecZ/LengthDP# = ( ( RootNX * VecNX ) + ( RootNY * VecNY ) + ( RootNZ * VecNZ ) )DebugLog(DP)C# = Cos(FOV/2) ;or ACos(FOV/2)DebugLog(C)If( DP >= C ) ;point is inside cone DebugLog("is inside")Else If( DP < C ) ;point is outside cone DebugLog("is outside")EndIWaitKey()End()but it does not seem to work correctly (or maybe the Cos() / ACos() function of Blitz3d is not adequate ?)@Gabor>>very nice, i really have to learn to code custom shaders...

The FOV is in radians which is probably why it doesn't work.

FOV# = 3.141592/4 ;(corresponds to 45.0=180.0/4)

FOV# = 45.0 ;(=180.0/4)

QuoteThe FOV is in radians which is probably why it doesn't work.so what do you suggest to make it work ? (i have only a basic understanding of maths...)

You might want to check out this wee gem by Fredborg ..