libgdx / libgdx/box2dlights

FREQ - Set a light to be active but not illuminate

Open
#83 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
265
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Hi,

I think this would be a nice feature to have, to use in conjunction with Box2D and sensors. I was able to get the polygon made from the lit area of a light, and use that to create a Box2D body, fixture and sensor from this. However, this makes it reliant on the light being active before being able to get its shape, and sometimes, I don't want the light to be lighting anything, especially when I use the same system to carve out fog of war. Transparency is not an option a lot of imes, because of the blending involved with FoW etc. The best way would be a toggle to keep the light active, but not giving off light, while still interacting (raycasting) with Box2d objects.

An application for this feature would be toggling the light source to shed light, when an entity steps into its sensor range. In my specialized case, once a light starts illuminating, I can combine it's light field to the character's vision field, to create the actual visual area, and trigger/update all reliant controls, e.g. minimap, game events etc.

On a side note, I saw a FREQ for the ability to shed light to an FBO. I could perhaps use that to calculate light fields, cache them, and switch the lights off, although I think my FREQ is a simpler one to implement, and more accessible to novice users.

Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how lights are marked active, how illumination is generated, and how Box2D sensors and raycasting interact with that state. Compare the requested toggle with the FBO-based approach mentioned in the issue. Done means a light can remain active for shape and sensor calculations without illuminating, while normal lighting behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.