我有两个DYNAMIC主体body1和body2都定义为:
final BodyDef ballBodyDef = new BodyDef();
ballBodyDef.type = BodyType.DYNAMIC;
final PolygonShape ballShape = new PolygonShape();
ballShape.setAsBox(10f, 10f);
Body ballBody = world.createBody(ballBodyDef);
final Fixture ballFixt = ballBody.createFixture(ballShape, 0.2f);
ballFixt.setRestitution(0.7f);
ballFixt.setFriction(0.5f);
ballFixt.getFilterData().groupIndex = -1;
他们不会发生碰撞。
是否有一种简单的方法可以检查它们是否重叠?
public boolean overlapping(Body body1, Body body2) {
//Check overlapping ?
}