mirror of
https://github.com/eliasstepanik/big_space_with_trim.git
synced 2026-01-10 08:48:28 +00:00
Use get_single instead of single (#15)
`big_space` currently panics if you defer creation of the floating origin. Using `get_single` instead of `single` prevents this.
This commit is contained in:
parent
67f3c14b7a
commit
0dafa2b83c
@ -27,7 +27,9 @@ pub fn update_debug_bounds<P: GridPrecision>(
|
||||
occupied_cells: Query<&GridCell<P>, Without<FloatingOrigin>>,
|
||||
origin_cells: Query<&GridCell<P>, With<FloatingOrigin>>,
|
||||
) {
|
||||
let origin_cell = origin_cells.single();
|
||||
let Ok(origin_cell) = origin_cells.get_single() else {
|
||||
return;
|
||||
};
|
||||
for cell in occupied_cells.iter() {
|
||||
let cell = cell - origin_cell;
|
||||
let scale = Vec3::splat(settings.grid_edge_length * 0.999);
|
||||
|
||||
@ -322,7 +322,9 @@ pub fn update_global_from_grid<P: GridPrecision>(
|
||||
Query<(GridTransformReadOnly<P>, &mut GlobalTransform)>,
|
||||
)>,
|
||||
) {
|
||||
let (origin_cell, floating_origin) = origin.single();
|
||||
let Ok((origin_cell, floating_origin)) = origin.get_single() else {
|
||||
return;
|
||||
};
|
||||
|
||||
if origin_cell.is_changed() || floating_origin.is_changed() {
|
||||
let mut all_entities = entities.p1();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user