-
Notifications
You must be signed in to change notification settings - Fork 82
How To
SimonIT edited this page Nov 10, 2024
·
9 revisions
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
- Sample code and showcase available at libGDX.info
- For more details, see this example.