Collision checkers
-
- Posts: 1
- Joined: Thu May 29, 2014 9:09 am
Collision checkers
Hello. I'm making a simple dogfight game. I use the BEPU physics engine and it works fine, but I have a problem with implementing AI. I'd like to create a cone that is always in front of the aircraft. That is simple. What is not simple is that, I'd like the cone to be 'ghost-like', it should report collisions, but should not affect other bodies' behaviour. Is it possible to be done? Otherwise, is there another way to do this?
Re: Collision checkers
Collision rules would work. The CollisionFilteringDemo in the BEPUphysicsDemos provides some usage examples.
Another common approach to this sort of query is rays rather than an actual cone shape. If the query should take into account occlusion, rays will likely be a more natural fit since they stop on impact (or provide a sorted list of impacts). It's possible to approximate a cone without casting dozens or hundreds of rays per frame, too. For example, a direction could be sampled from within the cone each frame according to some heuristic (random or otherwise) and a ray could be sent in that direction. Over the course of multiple frames, the queries will provide good coverage of the cone volume. Depending on the nature of the query, scattered rays might end up being faster than a query shape.
Another common approach to this sort of query is rays rather than an actual cone shape. If the query should take into account occlusion, rays will likely be a more natural fit since they stop on impact (or provide a sorted list of impacts). It's possible to approximate a cone without casting dozens or hundreds of rays per frame, too. For example, a direction could be sampled from within the cone each frame according to some heuristic (random or otherwise) and a ray could be sent in that direction. Over the course of multiple frames, the queries will provide good coverage of the cone volume. Depending on the nature of the query, scattered rays might end up being faster than a query shape.