B4A Library Box2DLights

Box2DLights is a plugin for libGDX. It adds light sources to your Box2D scene. A light source can be attached to a body and move with it.
For more information about this library, please read this wiki.

v0.9:
Initial release

v1.0:
- Bugfixes
- New class: lgB2L_ChainLight
- New functions
- Better documentation
- New demo

v1.01:
- Incompatibility with libGDX v1.10 fixed;
- New function: lgB2L_RayHandler.ResizeFBO;
- Default soft shadow length set to distance * 0.1.

lights.jpg
screenshot.jpg
 

Attachments

  • Box2DLights v1.01.zip
    268.8 KB · Views: 303
Last edited:

walterf25

Expert
Licensed User
Box2DLights is a plugin for libGDX. It adds light sources to your Box2D scene. A light source can be attached to a body and move with it.
For more information about this library, please read this wiki.

I'm not responsible for the approximate english of the documentation. Feel free to help me to improve it.

View attachment 23924
Very Nice Frederic, i'm going to give it a try today!

Thanks,
Walter
 

ilan

Expert
Licensed User

wonder

Expert
Licensed User
In my current project I'm not using Box2D at all.
Nevertheless I'd like to utilize this library in order to have some cool lighting effects.

Would I have to replicate each game object as a Box2D object or could I just associate a Box2DLight object to a posX, posY of one of my current objects?

Thanks in advance! :)
 

Informatix

Expert
Licensed User
Would I have to replicate each game object as a Box2D object
No. You can either attach the light to a body (with AttachToBody) or set its position (with Position.Set). If objects entering the light radius are not Box2D objects, the rays cannot be stopped so there will be no shadow.
 

ilan

Expert
Licensed User
Last edited:

ilan

Expert
Licensed User
hi @Informatix in your ChainLight example it says that the polygons were created with Polygon Editor v0.2.1

'Complex shape created with Physics Body Editor v2.9.2 and Polygon Editor v0.2.1

i could not find such an editor, i only am able to find the Physics Body Editor. Do you have maybe a link?

thanx, ilan
 

Informatix

Expert
Licensed User
hi @Informatix in your ChainLight example it says that the polygons were created with Polygon Editor v0.2.1



i could not find such an editor, i only am able to find the Physics Body Editor. Do you have maybe a link?

thanx, ilan
The link should be somewhere in the libGDX guide.
 
Top