Skip to main content

s2_to_osmap

Function s2_to_osmap 

Source
pub fn s2_to_osmap(s2: S2Map, source_filename: &str) -> OpenStrandedMap
Expand description

Convert a parsed .s2 map into an .osmap (Bevy convention).

§Coordinate conversion

.s2 stores positions in Blitz3D convention:

  • origin at terrain corner (0..terrain_size in both X and Z)
  • +Z forward

.osmap stores positions in Bevy convention:

  • origin centered at the terrain centre
  • −Z forward (Bevy standard)
  • units = grid cells (same as .s2, i.e. one unit per terrain segment)

The engine scales grid-cell units to world units by multiplying with the map’s step factor (step = 64.0 / terrain_size).