-
Notifications
You must be signed in to change notification settings - Fork 198
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
Hexagon generation seems to not working correctly #414
Comments
I think this is a bug with:
And possibly other coordinate conversions. (Needs further investigation) If I replace that conversion with impl From<AxialPos> for RowEvenPos {
fn from(axial_pos: AxialPos) -> Self {
let AxialPos { q, r } = axial_pos;
RowEvenPos {
q: q + (r + (r & 1)) / 2,
r,
}
}
} (see https://www.redblobgames.com/grids/hexagons/#conversions-offset) then your map seems to render correctly. |
Then this makes me think, maybe there's also problems with other AxialPos related conversions? This would probably need further testing, currently thinking on how to set it up. |
Yeah, I think they are all suspect. Especially anything using I think maybe we aren't seeing this in the It would be great if we could rework that example so that we can repro there. |
|
Just adding some actual rust tests for those conversion functions would probably be better. I'm personally more inclined to remove/simplify existing hex examples actually. |
IMO some of these examples show some important details of hex tilemap. Besides, I think it's easier to verify the system visually than figuring out valid coordinates, especially with hex. Although it is more robust and cheaper in developer time. |
I'm using
generate_hexagon
to select tiles that are in range for player to see. But this is what I get:It's supposed to be just a hexagon, but every other row below the center is shifted!
Here are code snippets of the project:
And also the project is on github: https://github.com/JohnTheCoolingFan/sands_of_merkhyl/tree/b69881fde365a79716ed8cb02999443350f8a832
The text was updated successfully, but these errors were encountered: