我有一個libgdx遊戲與Box2d和Box2d燈的作品。Libgdx讓燈忽略機構
我的問題是我如何讓Bodys/Bodydefs忽略來自Box2d Light的光源而不投射陰影?
謝謝。
PolygonShape groundBox = new PolygonShape();
groundBox.setAsBox(2f, 2f);
FixtureDef gridBox = new FixtureDef();
gridBox.shape = groundBox;
gridBox.density = 1.0f;
gridBox.filter.groupIndex = GRID_GROUP;
gridBox.filter.categoryBits = GRID_CAT;
gridBox.filter.maskBits = GRID_MASK;
bodyDefs[i][j] = new BodyDef();
bodyDefs[i][j].position.set(j*factor + factor, i*factor + factor);
bodyDefs[i][j].fixedRotation = true;
bodyDefs[i][j].type = BodyDef.BodyType.DynamicBody;
bodies[i][j] = world.createBody(bodyDefs[i][j]);
bodies[i][j].createFixture(gridBox);
handler = new RayHandler(world);
handler.setCombinedMatrix(camera.combined);
Filter filter = new Filter();
filter.groupIndex = GRID_GROUP; // GRID_GROUP = 1
filter.categoryBits = GRID_CAT; // GRID_CAT = 0x0001;
filter.maskBits = GRID_MASK; // GRID_MASK = 1;
new PointLight(handler, 1000, Color.RED, 2000, 0, height);
PointLight.setContactFilter(filter);
你有管理這個工作?我有同樣的問題。你可以分享你的獨奏或暗示嗎? – Veljko