Fixed-radius neighbour predicate

I’ve got to determine whether there is a at least one NodePath within a certain radius of the camera. Brute force always works, but I’m guessing it could be done faster with a collision sphere.

Would I have to put some sort of collision solid on each of the NodePaths I was to detect, or can I get away with just a sphere around the camera? I really can’t say I’m good with collisions and if I tried to answer this myself I’d probably have too many bugs to get the right answer anyhow.


That depends on whether you want to test for collisions with the geometry of the other models (which will be pretty slow) or with a sphere surrounding those models (which will be a rather fast calculation, but won’t be accurate to a per-polygon level of course).