aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src/collision
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-08-25 23:28:19 -0500
committermat <git@matdoes.dev>2023-08-25 23:28:19 -0500
commit472496b7b808b4c6ac6f8e161a5bc1d08f5b0524 (patch)
treeb839d9c63829c3e215940f05cdcf0b17cd226300 /azalea-physics/src/collision
parent2773146fbfd9b61c0ea09210b6d7b9760be5e7dc (diff)
downloadazalea-drasl-472496b7b808b4c6ac6f8e161a5bc1d08f5b0524.tar.xz
fix all bevy ambiguities
Diffstat (limited to 'azalea-physics/src/collision')
-rw-r--r--azalea-physics/src/collision/mod.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs
index 5d3da699..de9439ca 100644
--- a/azalea-physics/src/collision/mod.rs
+++ b/azalea-physics/src/collision/mod.rs
@@ -60,7 +60,12 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
let collided_movement = if movement.length_sqr() == 0.0 {
*movement
} else {
- collide_bounding_box(movement, &entity_bounding_box, world, entity_collisions.clone())
+ collide_bounding_box(
+ movement,
+ &entity_bounding_box,
+ world,
+ entity_collisions.clone(),
+ )
};
let x_collision = movement.x != collided_movement.x;
@@ -70,9 +75,8 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
let on_ground = physics.on_ground || y_collision && movement.y < 0.;
let max_up_step = 0.6;
- if on_ground && (x_collision || z_collision) {
- let mut hypothetical_new_position
- = collide_bounding_box(
+ if on_ground && (x_collision || z_collision) {
+ let mut hypothetical_new_position = collide_bounding_box(
&Vec3 {
x: movement.x,
y: max_up_step,
@@ -104,12 +108,15 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
entity_collisions.clone(),
)
.add(step_up_position);
- if var11.horizontal_distance_sqr() > hypothetical_new_position.horizontal_distance_sqr() {
+ if var11.horizontal_distance_sqr() > hypothetical_new_position.horizontal_distance_sqr()
+ {
hypothetical_new_position = var11;
}
}
- if hypothetical_new_position.horizontal_distance_sqr() > collided_movement.horizontal_distance_sqr() {
+ if hypothetical_new_position.horizontal_distance_sqr()
+ > collided_movement.horizontal_distance_sqr()
+ {
return hypothetical_new_position.add(collide_bounding_box(
&Vec3 {
x: 0.,