Skip to content

Rotate 2D light fix - #9005

Open
Raiguri wants to merge 4 commits into
4ian:masterfrom
Raiguri:rotate-2dlight-fix
Open

Rotate 2D light fix#9005
Raiguri wants to merge 4 commits into
4ian:masterfrom
Raiguri:rotate-2dlight-fix

Conversation

@Raiguri

@Raiguri Raiguri commented Aug 24, 2026

Copy link
Copy Markdown

For many years, 2D light implementation had an issue, that prevented users from rotating it in GDevelop.

So, I fixed it.

Screencast_20260824_123528.webm

Screencast_20260824_123459.webm

https://forum.gdevelop.io/t/2d-light-object-texture-rotation/72909

@Raiguri
Raiguri requested a review from 4ian as a code owner August 24, 2026 13:12
Update lightruntimeobject.spec.js test to expect SQRT2 scaled coordinates.
@4ian

4ian commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Hi! Thanks for submitting this. The tests seem to be failing, have a look at if you can see why? Thank you :)

@Raiguri Raiguri closed this Aug 24, 2026
@Raiguri Raiguri reopened this Aug 24, 2026
@Raiguri

Raiguri commented Aug 24, 2026

Copy link
Copy Markdown
Author

Hi! Thanks for submitting this. The tests seem to be failing, have a look at if you can see why? Thank you :)

Already looking into it. Perhaps I need to change lighting test entirely, because of new lighting changes.

now light mesh size changes based on rotation of light object
@4ian

4ian commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Are you confident this is now a 100% correct and minimal fix?

@Raiguri

Raiguri commented Aug 25, 2026

Copy link
Copy Markdown
Author

Are you confident this is now a 100% correct and minimal fix?

Unfortunately, I don't know how to do this differently (I lack knowledge and experience), it just was the straightest way of doing it in my opinion.

At first I just make so that texture rotated based on object angle, but I saw that quads just cutout the texture in some angles.

Then I just make so that quads are bigger, but lighting test was failing because size of quads wasn't correct, so in the end I just make size of quads change based on object angle.

@4ian

4ian commented Aug 25, 2026

Copy link
Copy Markdown
Owner

How could we know if it's a good solution or if there is a potential other one that would be worth investigating?
I'm not saying this is good or bad - I also don't know and want you to be sure this is the best one :)

@Raiguri

Raiguri commented Aug 25, 2026

Copy link
Copy Markdown
Author

How could we know if it's a good solution or if there is a potential other one that would be worth investigating? I'm not saying this is good or bad - I also don't know and want you to be sure this is the best one :)

All other approaches that I could think of are either more invasive, less efficient, or less integrated with the existing light鈥憆endering.

Actually, matrix-uniform approach might be slightly more elegant, especially if would need more complex transformations in future, but it would be kinda overkill and waste of time for such bug.

I just want this bug fixed, it was driving me insane for years, and I even dropped some of my projects, because of this notorious bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants