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

Shaky direction choosing on hex grid #100

Open
Battenhatch opened this issue Oct 6, 2024 · 3 comments
Open

Shaky direction choosing on hex grid #100

Battenhatch opened this issue Oct 6, 2024 · 3 comments

Comments

@Battenhatch
Copy link

Using About Face with the GURPS GGA system, I find that it often snaps the direction of the indicator, well, "wrong". Using hex grids, it often seems to choose a direction that seems non-intuitive to the direction the token has travelled. Does anyone else have this experience?

@StefanLeng
Copy link

I am also seeing that: On Hex Columns, moving up or down gives always the right direction. If you move in one of the "diagonal" hex directions, sometimes you get the correct diagonal direction, but somtimes the facing indicvator points up or down.
On hex rows, left and right works, but he diognals are wonky too.

@StefanLeng
Copy link

I investigated a bit closer: On a hex grid, the movemnts on the "diagonal" hex directions don't result in factional pixel distances that get rounded. Depending on the column/row, the distance is rounded up or down. So when moving one hex south-west on hex-columns even, the messuered directions is slightly grater than 150 on some columns and slightly lower than 150 on others.
About Face assings any angle >= 90 and < 150 to 90 and anything >= 150 and < 210 to 150, So it works as expected when founding up and not when roundig down.

About Face seems to assinge any angle to a cardinal direction that is >= this cardinal direction and < then next cardinal direction. That gives odd results also on square grids: When moving one square east and more than one square north (no mather how many), the resulting direction is north. But if moving one square west and any number of squares north, you always get north-west. That is a starnge asymetrie.

Woudn't it better to chose a cardinal direction for any angle in the interval halfways midpoinst between this direction and the previous and next direction?

@StefanLeng
Copy link

StefanLeng commented Jan 12, 2025

This behavior seems to be the result of this commit: e4478dd#diff-a2f9859a7925afd20d70d4825709ee85fa48b4f37f93c17bb11094121cc1f6abL92

The line

let secondAngle = facings.reduce((prev, curr) => (curr > prev && curr <= normalizedDir ? curr : prev), facings[0]);

is not eqivalent to the previous

let secondAngle = facings.find((e) => e > normalizedDir);

The orignal line finds the smallest angle > normalizedDir, the new line finds the greatest angle <= normalizedDir.

Was this change intentional?

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

No branches or pull requests

2 participants