In my project (tankbattles.sourceforge.net) I'm implementing a rotating tank radar. Right now I've been using a rotating cone over the tank as the radar. Looks really nice with alpha.
The thing is: For being usefull the radar has to detect the other tanks nearby as they get inside the cone. I'm doing this by detecting a collision with the enemy tanks and the cone, but two things are really annoing me:
1 - With triangle accuracy, which is precise, the performance sucks.
2 - No bounding collision mecanism is good for this, since it detects outside the cone and that's not nice.
I've been thinking in using ray collision, but that's not like a cone radar (It'd be really nice if I could do Parabolic, but cone is OK). What do you all think?
What I think would be REALLY nice was to detect the collision between the triangle-accurate Cone against the BoundingBox of the oher tank. Is there a way I can do this? Is it better in terms of performance?
It may be faster to iterate through a list of possible contacts and just do the distance and trig calculations to determine if its in your radar cone rather than doing collision detection in the scene.
In the simulation I worked on, this is how we did it, because it wasn't originally using any rendering system. When they wanted to visualize it then I made the radar scene object point in the direction of the logical radar. The cone was just a visualization of what was happening, not actually affecting anything.
I manually created a small Box and I'm testing the collisions between the cone (with very low polycount) with this Box and the performance is OK. I'll test with more tanks…