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

TilemapLayer#getTilesWithinShape does not return valid results when run with Phaser.Geom.Line #5640

Closed
hrecker opened this issue Apr 3, 2021 · 2 comments · Fixed by #6104

Comments

@hrecker
Copy link

hrecker commented Apr 3, 2021

Version

  • Phaser Version: 3.52
  • Operating system: Windows
  • Browser: Observed on Chrome and Firefox

Description

getTilesWithinShape does not return valid results when run with Phaser.Geom.Line. When a line spans two rows of tiles, tiles in the lower row can be left off of the results. It seems like the logic checking for the shape bounding box isn't valid for a line. I haven't tested with other shapes.

As an example - the tiles in the bottom row aren't returned by the function as expected.
phaserbug

Example Test Code

https://jsfiddle.net/gva74z1x/2/

Additional Information

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@bicarbon8
Copy link

bicarbon8 commented Jan 20, 2023

just tested this using the original jsfiddle and the 3.55.0 phaser library (original repro was using 3.54.0) and I can confirm the issue still exists https://jsfiddle.net/17v3atc9/
as an additional note I noticed that a completely horizontal line is only returning the first and last tiles it intersects with when it falls on the top pixel border of the tile row (confirmed by modifying the above jsfiddle to use a horizontal line at y=16 and then modifying it so the horizontal line was at y=20). in the case of horizontal at y=16 only the tiles intersecting with the start point and end point are returned and when the line is at y=20 all the tiles along the line are returned.

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

Successfully merging a pull request may close this issue.

4 participants