Using a HexLayout with a custom origin (non-zero) and building a mesh using either:
PlaneMeshBuilder
ColumnMeshBuilder
Will apply that offset to mesh vertices. Which makes sense but not for classic usage in bevy where like in the examples we build one mesh at Hex::ZERO to be centered on an Entity's Transform.
On that case the mesh is technically offsetted twice, once because of the mesh vertices , and second because we offset the entity transform using HexLayout::hex_to_world_pos which takes in account the layouyt origin
To Reproduce
Any interactive example with a custom HexLayout origin
Workaround
In order to have a correct behaviour we need to clone the layout, zero its origin, before building the mesh
Describe the bug
Using a
HexLayout
with a customorigin
(non-zero) and building a mesh using either:PlaneMeshBuilder
ColumnMeshBuilder
Will apply that offset to mesh vertices. Which makes sense but not for classic usage inbevy
where like in the examples we build one mesh atHex::ZERO
to be centered on anEntity
'sTransform
.On that case the mesh is technically offsetted twice, once because of the mesh vertices , and second because we offset the entity transform using
HexLayout::hex_to_world_pos
which takes in account the layouytorigin
To Reproduce
Any interactive example with a custom
HexLayout
originWorkaround
In order to have a correct behaviour we need to clone the layout, zero its origin, before building the mesh