Questions tagged [box2dlights]

Box2dLights is a open source framework for dynamic 2d lights and shadows for android and desktop using box2d physic geometry and raycasting.

Box2DLights is a 2D lighting framework that uses box2d for raycasting and OpenGL ES 2.0 for rendering. This library is intended to be used with libgdx.

34 questions
7
votes
2 answers

Libgdx light without box2d

I just started creating a game using libgdx. It is a top down 2d shooter using scene2d ui. Now i thought, that i could add darkness and light to some levels, but i don't want to rewrite everything using box2d. I don't need realistic shadows just…
Robert P
  • 9,398
  • 10
  • 58
  • 100
5
votes
1 answer

Box2d raycast vs AABB query performance

I'm currently trying to improve performance of a game that makes use of box2d physics (actually box2dlights). I have a method that makes several (let's say about 16 to 64) raycasts within an known area. I wonder if it would be a good idea to make an…
Sebastian
  • 5,721
  • 3
  • 43
  • 69
4
votes
1 answer

Box2dlights - Layering lights

How do you make the box2dlights ignore textures and sprites in ambient lighting? For example I have a stage that has the ambient lighting set to dark. I want my lights to brighten up a platform directly underneath the light, but the background…
2
votes
1 answer

Adding rayhandler in LibGDx causes issues in InputListener

I am trying out Libgdx, and I have an actor which performs some action whenever we click on it. So far it is working fine. Now I want to add light to the actor. After doing some research I came across Box2DLights. When I tried adding it to my…
hello123
  • 391
  • 4
  • 15
2
votes
0 answers

Libgdx Box2dLights: How to make light have a hard falloff?

I am implementing a relatively simple game and I want the lighting system to work as if things are either in total darkness or total light, all the lights though are bright at the origin and become progressively darker until they fade off. I want…
Nectar Zuzi
  • 493
  • 1
  • 4
  • 7
1
vote
0 answers

(Box2dLights) Disable Light for a certain Texture?

I want add stars on my 2D game, like Terraria-Starbound-Minecraft (School project and hobby). https://i.stack.imgur.com/fCGH3.png Perfect, but when the night comes... The stars are dark! https://i.stack.imgur.com/3MbgM.png I want show the stars…
1
vote
2 answers

Access rays cast by Box2D Lights

I am currently developing a game with the Box2D lights library and LibGDX. Everything is currently fine, however, I'm having difficulty accessing the rays from the ConeLight. I wish to stop rendering objects if they are not in the ray of the…
Ryan_DS
  • 750
  • 7
  • 28
1
vote
1 answer

How to adjust the viewport while rendering box2Dlights?

I'm writing game similar to Don't Starve using Libgdx and Box2Dlights. I have a flat-surface world with some billboarded objects on this surface. So the perspective camera is used. The angle between the normal to the screen and the normal to the…
1
vote
1 answer

Java LibGDX Box2D lighting bug

I have recently started a tile based game. So far so good, I implemented Box2D and added rigid bodies for the tiles. Then I added Box2D Lights. This is where the problem arose. This is a screenshot of the issue: Image. As you can see half the screen…
1
vote
2 answers

Java / box2DLights - Wrong light position

I'm using Libgdx for a project and more precisely Box2DLights. My problem is the following one : When I want to put a new "PointLight" it's always on the center of the screen. And if I change the coordinates, it doesn't work. Inside my "show()"…
Simulacre
  • 89
  • 6
1
vote
2 answers

LibGDX Box2DLights throws error on render

I am trying to get a Box2D PointLight to render on the screen, but upon rendering, it throws an exception. I have revised the API and the Box2D User Manual, as well as watched videos on the topic, but have yet to find a solution to my problem. Here…
user5074791
1
vote
1 answer

Box2D Lights Wall Shadowing

Alright, so I've been pondering over this for quite awhile now; looking through documentation, examples, previously made games, ect... Basically (for those familiar with Box2d Lights), I'm trying to create bodies on top of my walls (so there's…
Gosre
  • 61
  • 9
0
votes
1 answer

Libgdx Box2D Lights, looking diffrent on android devices, strange outlines of light

Recently I have been trying to learn how to use Box2D lights. I have tried implementing them into one of my simple games. Everything worked and looked nice (on PC) until I run it on my phone. The lights looks completely different and I don't even…
Kseniu
  • 1
0
votes
1 answer

LibGdx Box2dLights: How to make Chain Lights emit light in all directions?

The "ChainLight" Class has a parameter in its constructor which is called "rayDirection": ChainLight(rayHandler, rays, Color, distance, rayDirection, float[] vertices) Apparently, if it is set to "1", the light direction is left and if it is "-1",…
Ozzy
  • 103
  • 3
0
votes
0 answers

RayHandler doesn't goes with Box2D world

I have a difficult situation. I'm making a 2D game and I'm on the step of integrating box2Dlights part. But when i'm rendering my RayHandler, I have a black screen. Here is another image, where I don't render my lights. There is no lights now. I…
1
2 3