Checking if there's no contact ?

Hey, I know this might be a dumb question but I can't find anything on that subject.

But I want to check if a box is NOT touching another, how am I suposed to do that ?

Box2D 2.0.2 please ^^ (I know there's some changes with 2.1a but I'm not sure if my question could be resolve in another way in 2.1a)

thanks !
my guess is you would need to collect all your contacts and iterate over them to check if one of the bodies involved is not the body you're interested in.
maybe there's some other way but that's on the top of my head.
a good place to start may be here
vitaLee wrote:
my guess is you would need to collect all your contacts and iterate over them to check if one of the bodies involved is not the body you're interested in.
maybe there's some other way but that's on the top of my head.


Yeah I tough about that, but wouldn't that be really performance conssuming ?

yambanshee wrote:
a good place to start may be here


Sadly that won't do it... I need to find if there's a way to check if there's NO contact between 2 shapes :S
Sadly that won't do it... I need to find if there's a way to check if there's NO contact between 2 shapes :S[/quote]

if (shape1 == b2Body1 && shape2 != b2Body2)

wouldn't something like that work?
That wouldn't since I'm trying to listen to my bike being in the air and since there's no contact, there's no way to know that there's none. At least not that I know of.

The only way I found is by checking if the wheels are "Removed" from the contact list, but still it looks like sometime that won't do it. (Add Contact => wheelOnFloor = true..., Remove Contact => wheelOnFloor = false, of course I have to var one for each wheel)
if your using some sort of a suspension system like shock absorbers (which i actually need help with) you might be able to check if their is any forcing acting on them that are making them compress (meaning the weight of the bike is pushing down on it). It might be worth a try because the only other solution (having never actually worked with contact listeners myself) that i can think of is looping through all the contacts and if none of them are with the wheel, then it means the wheel is not touching, and that would be inefficient coding and could cause lag

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