Contact Listener not working in Libgdx
问题 I am developing a game in Libgdx and I am working on collision detection between two bodies in box 2D. I used "Contact Listener" to detect collision but nothing happens when the bodies collide. This is my code public Player(World world,float x,float y,float width) { this.width=width; //IMP height=width*2; BodyDef polygon=new BodyDef(); polygon.type=BodyType.DynamicBody; polygon.position.set(x,y); // polygon.fixedRotation=true; PolygonShape poly =new PolygonShape(); poly.setAsBox(width/2