Yes, I'm using contact listener, works perfectly for each of my box bodies:
I'm initializing my Sprite with this way:
Quote:
final Sprite saw = new Sprite(x, y, width, height, sawTextureRegion);
final Body sawBody = PhysicsFactory.createCircleBody(mPhysicsWorld, saw, BodyType.KinematicBody, wallFixtureDef);
sawBody.setUserData("sawObstacle");
and inside my contact listener:
Code:
private ContactListener contactListener()
{
ContactListener contactListener = new ContactListener()
{
@Override
public void beginContact(Contact contact)
{
final Fixture x1 = contact.getFixtureA();
Fixture x2 = contact.getFixtureB(); //player
if (x1.getBody().getUserData().equals("sawObstacle") && x2.getUserData().equals("player"))
{
// action
}
}
But it doesn't seem to receive any contact while body is circle shape, if I just change createCircleBody to createBoxBody - everything works, action from contact listener is being executed after contact.
Thanks for answer!