Skip to content

Fix attached entities staying too bright#4984

Open
TheCrazy17 wants to merge 1 commit into
multitheftauto:masterfrom
TheCrazy17:fix/attached-object-brightness
Open

Fix attached entities staying too bright#4984
TheCrazy17 wants to merge 1 commit into
multitheftauto:masterfrom
TheCrazy17:fix/attached-object-brightness

Conversation

@TheCrazy17

Copy link
Copy Markdown
Contributor

Summary

CObject::PreRender only recalculates an entity's contact-surface brightness ("lighting") while it isn't attached to anything, so an attached entity keeps whatever value it had at attach time (the constructor default, which renders much too bright) forever.

CClientEntity::DoAttaching now copies the lighting value from whatever the entity is attached to, every frame, mirroring what vanilla hand-held objects already do with their owning ped.

Any entity attached to another (e.g. via attachElements) renders visibly too bright/washed-out compared to its surroundings, because it's stuck with its default lighting value instead of picking up the lighting of whatever it's attached to.

mta-screen_2026-06-26_19-18-27

Motivation

Fixes #2203.

Test plan

  • Attached an object to a vehicle/ped in a dark area and confirmed it now matches the lighting of the entity it's attached to, instead of rendering at the default (too bright) value.
  • Moved the attached entity between differently-lit areas and confirmed the brightness keeps updating every frame instead of getting stuck at the value from attach time.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

CObject::PreRender only recalculates an entity's contact surface
brightness while it isn't attached to anything, so an attached
entity keeps whatever value it had at attach time (the constructor
default, which renders much too bright) forever.

DoAttaching now copies the lighting value from whatever an entity is
attached to every frame, mirroring what vanilla hand-held objects
already do with their owning ped.

Fixes multitheftauto#2203
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.

Attached objects using attachElements get unusually bright

1 participant