Talk:Ents.FindInCone
From GMod Wiki
Garry only added this 18 hours ago, so we don't know everything about it. If anybody knows what type the arguments are / has any examples or anything please add them. --~Toneo 22:01, 13 June 2008 (GMT-6)
This function does not appear to work at all. --Jephir 21:50, 1 July 2008 (GMT-6)
found out what it does
it finds stuff in a half-sphere, or maybe a spherical cap (see wikipedia)
i'll update the description of it. TomyLobo
Seems Broken
Through testing, I've found it doesn't *seem* to work, or at least not as I'd expect it to. So, I've made the following code as a surrogate:
function ents.FindInConeFix(p1,p2,Radius) -- apex, base point, base radius local tbl = {} local dist = p1:Distance(p2) local v1 = p2-p1 v1:Normalize() for k,v in ipairs(ents.GetAll()) do local v2 = v:GetPos()-p1 v2:Normalize() if v1:Dot(v2) >= (math.atan2(Radius,dist)*2) then table.insert(tbl,v) end end return tbl end
Levybreak 20:29, 26 September 2009 (UTC)