Pregunta

Is there a way to make two box2d sensors, attached to different bodies, interact with each other? I don't want to make them usual fixtures because they should pass through everything and just detect collisions with other fixtures and similar sensors.

If sensors can't interact at all, is there some good way to receive an event through b2ContactListener about overlapping shapes but letting them to pass through everything?

¿Fue útil?

Solución

@Justas Sakalauskas is just plain wrong. Sensors are made exactly for that purpose. They detect collisions/overlaps just like normal fixtures, but they are basically like "ghost" fixtures. Upon collision they do not result in any kind of force being applied to the colliding fixtures to push them apart.

Thus they perfectly fit your use case and they are used this way by many others as well.

Otros consejos

Okay, so sorry for some misunderstanding. If you'r question is how to make two fixtures not collide but still receive beginContact then sensors are the way to go. In beginContact you just check isSensor flag of fixture and you are good to go.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top