I have some falling dynamic objects that when touched turn into static objects so that they stay in place. However, I still need collision detection, which doesn't work when A and B are both static objects.
So my question is, is it possible to have a dynamic object behave like a static object, i.e. its position be unaffected by gravity and collisions? If not, how else can I solve this problem?
You could turn them into sensors with zero gravity scale and/or create sensors overtop of them?
I've tried sensors. Sensors have the same problem of not being able to detect static objects.
Yeah, static and kinetic bodies do not collide with each other because of their nature (and they shouldn't). I'm assuming you need contact or collision info of two static objects that are supposed to be touching each other? Why not just save the previous info before they froze and use that info for whatever?
By copying the values into variables or another object.
What do you actually need from having two static objects colliding?
I still don't understand your statement. Yes, I could copy the information, but how does that help me detect when a static object collides with another static object?
When they are touched, they become static objects, right? So right when they become static objects, store in some variable (or whatever) so that your game (not Box2D) thinks they are still touching.
I was suggesting you could copy the information because I was assuming you needed the specific contact information, not just the fact that they should be colliding. I just don't know what you need specifically from two static objects colliding. Do you need it to register a collision response or should they move a little so they don't overlap?