Simplify some conversions.

This commit is contained in:
Nolan Darilek 2022-01-19 18:37:04 -06:00
parent c0980f66c1
commit 488037d074

View File

@ -227,7 +227,7 @@ fn spawn_colliders(
if tile.blocks_motion() {
let id = commands
.spawn_bundle(ColliderBundle {
shape: ColliderShapeComponent(ColliderShape::cuboid(0.5, 0.5)),
shape: ColliderShape::cuboid(0.5, 0.5).into(),
position: Vec2::new(x as f32 + 0.5, y as f32 + 0.5).into(),
..Default::default()
})
@ -322,10 +322,7 @@ fn spawn_colliders(
);*/
let id = commands
.spawn_bundle(ColliderBundle {
shape: ColliderShapeComponent(ColliderShape::cuboid(
half_width,
half_height,
)),
shape: ColliderShape::cuboid(half_width, half_height).into(),
position: Vec2::new(x, y).into(),
..Default::default()
})
@ -349,8 +346,8 @@ fn spawn_colliders(
let aabb = shape.compute_aabb(&position);
let id = commands
.spawn_bundle(ColliderBundle {
collider_type: ColliderTypeComponent(ColliderType::Sensor),
shape: ColliderShapeComponent(shape.clone()),
collider_type: ColliderType::Sensor.into(),
shape: shape.clone().into(),
flags: ActiveEvents::INTERSECTION_EVENTS.into(),
position,
..Default::default()
@ -431,7 +428,7 @@ fn spawn_portal_colliders(
.entity(portal_entity)
.insert_bundle(ColliderBundle {
collider_type: ColliderTypeComponent(ColliderType::Sensor),
shape: ColliderShapeComponent(ColliderShape::cuboid(0.5, 0.5)),
shape: ColliderShape::cuboid(0.5, 0.5).into(),
position,
flags: ActiveEvents::INTERSECTION_EVENTS.into(),
..Default::default()