Possible to detect collision before simulation is started?

Hi,

I've just started to explore box2d, and so far it's been a pleasure to work with! However in my simple test program (using c++ and the c++ box2d lib) I would like to detect collisions *before* I start the simulation. Is that possible in box2d somehow? I'm trying to implement a function where a user can "drag & drop" different objects into the world and I want to force new objects to be place in an empty spot. So basically it would be good enough to just detect any collision between any object at that stage (before simulation starts).

Apologize if it's a stupid question as I might missed something while browsing the doc, I'm a beginner using box2d.

Cheers!
You can use the functions in b2Collision.h on your shapes.
Ok,.. I guess that basically that means manual handling and iterating through all objects shapes to check the distance between them. Isn't there any internal stuff already in place to check this? even if its private I could live with some hack to enable it, just need to know where to look.. trying to figure out if I can use the contactmanager directly in some way.

Thanks for box2d, it's an amazing work you've done with it!

Cheers!
Hmmm... not sure if I'm interpreting your question correctly. Why not run the simulation and allow the engine to check for collisions? Like you said, it already has that stuff there. What I'm envisioning here is you maintain a list of the definitions and such that you use to create the world. In "editor" mode, however, they are all static (or all their velocities are 0, etc) The object being placed is a "sensor". Might need to refilter the contact filters on occasion, depending on the circumstance, but that's no problem. Then, once the object is placed and you're ready to go, rebuild the world with velocities "turned on".

Bill
It should be possible to take a time step of zero length.
Thanks for all help,

I ended up with some combination of the above. However using a zero time step was pretty much the key to my problem. It was that easy. 🙂

Cheers

Original thread: https://box2d.org/forum/viewtopic.php?t=1315