Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hex light construction #4979

Merged

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented Oct 5, 2024

Identify the Bug or Feature request

Fixes #4978

Description of the Change

For some reason hexes had an adjustment applied based on the token footprint. But light shapes should always use (0, 0) as the origin, since other code will translate that to the necessary point. This PR removes that adjustment.

The other issue regarding hex size was fixed by treating the range as an inradius instead of circumradius.

Also included is a refactoring to Grid.createHex(). Nothing used the rotation parameter, and without that all hexes look the same aside from scale. So I removed the trig and loop and replaced it with six explicit points.

Possible Drawbacks

Slightly different areas will be illuminated by hex lights with this change.

Documentation Notes

For hex lights, the range measures to the edge of the hex.

Release Notes

  • Fixed a bug where hex lights on hex grids were slightly offset
  • Fixed a bug where hex lights were significantly smaller than equivalent square lights.

This change is Reviewable

The proportions and center were just all wrong. `Grid.getShapedArea()` should always treat (0, 0) as its origin for the
light, so no adjustments are needed to account for the grid or token shape.

Also fixed a bug where the hex radius would measure to the vertices instead of the edges (compare with square lights
that measure to the edges).

Since we're modifying the hex code anyways, also refactored to be more direct. We don't need trig - there's only six
points and they're always the same up to scale. Well, until the day we account for stretched hex grids.
@kwvanderlinde kwvanderlinde self-assigned this Oct 5, 2024
@cwisniew cwisniew enabled auto-merge October 9, 2024 22:48
@cwisniew cwisniew added this pull request to the merge queue Oct 9, 2024
Merged via the queue into RPTools:develop with commit 7ca4c40 Oct 9, 2024
4 checks passed
@kwvanderlinde kwvanderlinde deleted the bugfix/4978-hex-light-center-and-scale branch October 21, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[Bug]: Hex lights are not centered and are not scaled right
2 participants