Talk:In view cone snippet

From Valve Developer Community
Jump to: navigation, search

It would be nice if there was an explanation of what range 'tolerance' should be. Rek55 16:15, 16 Nov 2008 (PST)

After some research on dot products and vector math (I'm only in pre-calculus atm, so please correct me on this if I'm wrong), I think I figured this out. If your FoV is 75 degrees, for example, something is visible if angle of the normalized vector of its position relative to yours and the normalized vector of your facing direction is less than or equal to 37.5 degrees. The dot product could be said to be, in this case, the cosine of this angle. So, the tolerance should be set to the cosine of the maximum angle away from your facing direction that you wish to decide is visible. To answer your question, you should set the tolerance between 1(directly in front of you) and 0(90 degrees away from your facing direction). You'll probably want something between .7 and .8. --Lorem 20:42, 26 April 2009 (UTC)