Correct center calculation for visibility colliders.
This commit is contained in:
parent
184cfac47e
commit
288b1605b9
11
src/map.rs
11
src/map.rs
|
@ -313,17 +313,18 @@ fn spawn_colliders(
|
|||
"Top left: {:?}\ntop right: {:?}\nbottom left: {:?}\nbottom right: {:?}",
|
||||
top_left, top_right, bl, br
|
||||
);*/
|
||||
let center = (bl.0 as f32 + half_width, br.1 as f32 + half_height);
|
||||
let x = center.0;
|
||||
let y = center.1;
|
||||
let center = (
|
||||
bl.0 as f32 + half_width + 0.5,
|
||||
br.1 as f32 + half_height + 0.5,
|
||||
);
|
||||
/*println!(
|
||||
"Create shape at {:?} of width {} and height {}",
|
||||
"Create shape at {:?} of width {:?} and height {:?}",
|
||||
center, width, height
|
||||
);*/
|
||||
let id = commands
|
||||
.spawn_bundle(ColliderBundle {
|
||||
shape: ColliderShape::cuboid(half_width, half_height).into(),
|
||||
position: Vec2::new(x, y).into(),
|
||||
position: Vec2::new(center.x(), center.y()).into(),
|
||||
..Default::default()
|
||||
})
|
||||
.insert(MapObstruction)
|
||||
|
|
Loading…
Reference in New Issue
Block a user