Migration to bevy_ecs_tiled v0.9
This guide outlines the steps required to migrate your project to version 0.9 of bevy_ecs_tiled.
Main Changes
- Improved Isometric Map Support:
Isometric maps are now much better supported, including correct physics collider shapes and placement. - Accurate Physics Colliders for Isometric Maps:
Physics colliders are now generated with the correct geometry and position for isometric maps. - Clear Distinction Between
grid_sizeandtile_size:
Previously,tile_size(the actual size of a tile) andgrid_size(the space a tile occupies on the grid) were treated as equivalent. This is not always true, especially for isometric maps. The API now enforces a clear distinction. - API Renaming for Clarity:
Several functions and methods have been renamed to improve clarity and expressiveness.
Migration steps
-
Update the dependency in
Cargo.toml:bevy_ecs_tiled = "0.9" -
Adjust function usage:
-
Removed:
tile_size_from_grid_size()has been removed.
Reason: Avoids confusion betweentile_sizeandgrid_size.tile_size_from_map()has been removed.
Reason: You should useTiledMapAsset::largest_tile_sizeinstead. -
Added:
A newtile_size()helper function is available to retrieve thetile_sizefrom aTile. -
Changed:
TiledMapAsset::world_space_from_tiled_position()is now private to the crate.
Reason: This is a low-level function and should not be used directly.TiledMapAsset::object_world_position()→ Renamed toTiledMapAsset::object_relative_position()
Signature remains the same.TiledMapAsset::tile_world_position()→ Renamed toTiledMapAsset::tile_relative_position()
Now takes an extraTilemapTileSizeargument instead of relying on the map'sTilemapGridSize.
-
Updated Geometry Methods:
The following methods onTiledObjectnow take 4 additional arguments to properly handle isometric maps:center()vertices()line_string()polygon()