This needs to be added to your project to integrate box2dlights
in ApplicationListener#create:
rayHandler = new RayHandler(world);
You can disable shadows with:
rayHandler.setShadows(false);
You can set the ambient light with
rayHandler.setAmbientLight(R, G, B, Alfa); rayHandler.setBlurNum(3);
This will create a new white-point light. RAY_NUM is the number of ray lights (e.g.: 4 is a simple star).
new PointLight(rayHandler, RAYS_NUM, new Color(1,1,1,1), lightDistance, x, y);
In your render() loop, after you have drawn everything you want to light:
rayHandler.setCombinedMatrix(camera); rayHandler.updateAndRender();
Remember to dispose():
rayHandler.dispose();
Examples of Box2d lighting
There was an error while loading. Please reload this page.