You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Foundry V12 greatly improves support for hex grids, including adding support arbitrarily large hex tokens and non-symmetrical hex token shapes. Various changes relevant to this module are:
The "center" of the token now falls on a hex vertex or edge midpoint for some shapes if it doesn't align to the center of a hex.
There is native support for alternate orientations and more shape types. The old foundry behavior is now "Ellipse (Variant 1)" for most tokens and "Ellipse (Ellipse 2)" for the old 2×2 behavior, with variant 1 generally being the standard orientation and variant 2 being alt orientation is hex-size-support terms.
Snapping for all sizes in now handled directly by the grid correctly for all hex orientations and sizes. Snapping can be accessed for a canvas object such as a token via its getSnappedPosition method, which take a point corresponding to the token's topleft and returns that point snapped to the grid correctly for the parameters of the token.
There are two additional shape types, Trapezoid and Rectangle, each having 2 orientation variants.
The aforementioned support for arbitrarily sized hex tokens. The token class now has an (internal IIRC) method to get the border polygon for a token based on size parameters.
Internally, the hex grid is now properly tessellated hexagons instead of alternately offset rectangle "bricks". This means that the topleft point of a cell can't be directly translated back to a center point as it lies inside a different hex now.
Generally, these changes allow for modules to have a much lighter touch on hex grids. Hex Token Size Support (soon to become Token Border Supplements) in fact no longer makes any changes to tokens on hex grids outside of its border style changes and the optional hotkey to swap orientation variants.
Currently the module has severe issues with snapping on hex grids. Nearly every hex shape other than odd × odd elliptical tokens snaps incorrectly, size 2 being the worst offender. Additionally, moving a token on a hex scene can cause hundreds of deprecation warnings to fill the console.
For references, this is the HSS v12 isAltOrientation function: https://github.com/BoltsJ/hex-size-support/blob/4.x/v12-fixes/src/modules/grid.js
It's not used anywhere internally by HSS, and I'll probably end up removing it.
And here is code I wrote for Lancer to get an arbitrary sized n × n hex: https://github.com/Eranziel/foundryvtt-lancer/blob/27cca45fd5c4230cc6dcd376045aa68495523edc/src/module/token.ts#L13-L56
It doesn't cover the unusual shapes but it gets a majority of what people are using. In the past, this function tested points against the token shape to find the the spaces, however when computing many tokens simultaneously, there was a performance impact from calling pixi functions. A similar approach may be feasible in v12 with less of a performance hit now that token geometry is exposed publicly on Token#shape.
The text was updated successfully, but these errors were encountered:
Foundry V12 greatly improves support for hex grids, including adding support arbitrarily large hex tokens and non-symmetrical hex token shapes. Various changes relevant to this module are:
Generally, these changes allow for modules to have a much lighter touch on hex grids. Hex Token Size Support (soon to become Token Border Supplements) in fact no longer makes any changes to tokens on hex grids outside of its border style changes and the optional hotkey to swap orientation variants.
Currently the module has severe issues with snapping on hex grids. Nearly every hex shape other than odd × odd elliptical tokens snaps incorrectly, size 2 being the worst offender. Additionally, moving a token on a hex scene can cause hundreds of deprecation warnings to fill the console.
For references, this is the HSS v12 isAltOrientation function: https://github.com/BoltsJ/hex-size-support/blob/4.x/v12-fixes/src/modules/grid.js
It's not used anywhere internally by HSS, and I'll probably end up removing it.
And here is code I wrote for Lancer to get an arbitrary sized n × n hex: https://github.com/Eranziel/foundryvtt-lancer/blob/27cca45fd5c4230cc6dcd376045aa68495523edc/src/module/token.ts#L13-L56
It doesn't cover the unusual shapes but it gets a majority of what people are using. In the past, this function tested points against the token shape to find the the spaces, however when computing many tokens simultaneously, there was a performance impact from calling pixi functions. A similar approach may be feasible in v12 with less of a performance hit now that token geometry is exposed publicly on Token#shape.
The text was updated successfully, but these errors were encountered: