Reputation: 470
When i create an object in libgdx and Box2D it is automatically affected by light and it is casting shadows. Is there a way to make an object that does not cast shadows?
Upvotes: 1
Views: 999
Reputation: 19776
Shadows happen when a Light
ray collides with a Fixture
. This collision handling is done via standard box2d queries and it uses the box2d Filter
. See the code here.
You can set your filter bits via the following method found in Light
:
/**
* create new contact filter for ALL LIGHTS with give parameters
*/
static public void setContactFilter(short categoryBits, short groupIndex,
short maskBits) {
filterA = new Filter();
filterA.categoryBits = categoryBits;
filterA.groupIndex = groupIndex;
filterA.maskBits = maskBits;
}
To understand how this works, check out the Box2D manual chapter 6.2 (Filtering).
Upvotes: 2