libgdx - Objects pass through each other -
i've 2 objects, 1 static , 1 dynamic. fixtures of both of them created chainshape
. problem pass through each other.
screenshot :
two chainshapes dont collide each other make 1 of them polygonshape. works me:
bodydef triangledef = new bodydef(); triangledef.type = bodydef.bodytype.dynamicbody; triangledef.position.set( 0, 0 ); body trianglebody = this.world.createbody( triangledef ); polygonshape triangleshape = new polygonshape(); triangleshape.set( new float[]{ 0, 0.5f, -0.5f, -0.5f, 0.5f, -0.5f } ); trianglebody.createfixture( triangleshape, 1 ); triangleshape.dispose(); bodydef grounddef = new bodydef(); triangledef.position.set( 0, 0 ); body groundbody = this.world.createbody( grounddef ); chainshape groundshape = new chainshape(); groundshape.createloop( new float[]{ -10, 10, -10, -10, 10, -10, 10, 10 } ); groundbody.createfixture( groundshape, 1 ); groundshape.dispose();
Comments
Post a Comment