Hi all,
This is related to one of my other posts (viewtopic.php?f=3&t=4781) but seems to be a separate issue so I thought it warranted its own topic.
I have a situation where I want to "reverse" gravity. To do this, I simply call SetGravity with a new b2Vec2 representing the opposite vector. This works, and objects "float up" as I would expect, however I'm having a problem with my b2ContactListener.
Specifically, when I reverse gravity I am getting a premature "EndContact" call from the listener.
For example:
I have a simple box polygon (b2_dynamicBody) which needs to know when it's "in contact" with another box (b2_kinematicBody). When gravity is "normal" (pointing down) I get a BeginContact call when my b2_dynamicBody box lands on the other b2_kinematicBody, and I get the expected EndContact call when my box is no longer touching the b2_kinematicBody. But.. when gravity is reversed and I "float up" to hit the b2_kinematicBody from underneath I get an initial BeginContact event (expected), immediately followed by an EndContact event (not expected).
As a result my box "thinks" it is not in contact with the b2_kinematicBody, but it is happily resting on (under) it.
Is there an implication to my reversal of gravity that is going to screw with what box2d things about the state of the world? Is the "underneath" of a b2_kinematicBody somehow immune to contact persistence?
Thanks for any help.
Jason.
This is related to one of my other posts (viewtopic.php?f=3&t=4781) but seems to be a separate issue so I thought it warranted its own topic.
I have a situation where I want to "reverse" gravity. To do this, I simply call SetGravity with a new b2Vec2 representing the opposite vector. This works, and objects "float up" as I would expect, however I'm having a problem with my b2ContactListener.
Specifically, when I reverse gravity I am getting a premature "EndContact" call from the listener.
For example:
I have a simple box polygon (b2_dynamicBody) which needs to know when it's "in contact" with another box (b2_kinematicBody). When gravity is "normal" (pointing down) I get a BeginContact call when my b2_dynamicBody box lands on the other b2_kinematicBody, and I get the expected EndContact call when my box is no longer touching the b2_kinematicBody. But.. when gravity is reversed and I "float up" to hit the b2_kinematicBody from underneath I get an initial BeginContact event (expected), immediately followed by an EndContact event (not expected).
As a result my box "thinks" it is not in contact with the b2_kinematicBody, but it is happily resting on (under) it.
Is there an implication to my reversal of gravity that is going to screw with what box2d things about the state of the world? Is the "underneath" of a b2_kinematicBody somehow immune to contact persistence?
Thanks for any help.
Jason.