0
votes

I am building a 2-D top-down game where I need to have a dynamic graph of the region for pathfinding.

I was thinking of overlaying a mesh of Box2D bodies (circles or squares) as "sensors" over the areas of interest. These object would all be static bodies and marked as sensors so there is no collision response, but there are collisions detected and I could use this (collision callback) to mark/unmark nodes in the navigation graph as being occupied so entities could navigate around them.

The moving entities will still be making ray-casts and AABB queries as part of their interaction with the environment (looking for specific things, etc.). I would like to not have their queries intersect with the sensor net.

While I can certainly use usertags and filtering in the listener objects used by the entities to filter out the sensors, I was wondering if there is already a way in Box2D to make AABB/Ray-Cast queries ignore certain fixtures?

1

1 Answers

1
votes

This check is usually best done in the query callback. Both b2RayCastCallback and b2QueryCallback have a ReportFixture function which gives you a fixture, so you can check if you want to ignore it or not.

(I'm not sure if that's what you meant by your last paragraph in the question... if so, then I guess the answer is just 'no' :)