diff options
| author | mat <git@matdoes.dev> | 2023-08-25 04:49:38 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-08-25 04:49:38 -0500 |
| commit | c7359e5bba97d24b5cff55c57ae9fcdbfbea2e7f (patch) | |
| tree | 4c93f6e2bedef909f679cd1ceaced3fc9a4a68f2 | |
| parent | 32eece4d376263fd48c03d7a25c36c87072f8987 (diff) | |
| download | azalea-drasl-c7359e5bba97d24b5cff55c57ae9fcdbfbea2e7f.tar.xz | |
name variables in stepping up
| -rw-r--r-- | azalea-physics/src/collision/mod.rs | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs index 96dc1991..5d3da699 100644 --- a/azalea-physics/src/collision/mod.rs +++ b/azalea-physics/src/collision/mod.rs @@ -71,21 +71,8 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics) let max_up_step = 0.6; if on_ground && (x_collision || z_collision) { - // Vec3 var9 = collideBoundingBox(this, new Vec3(movement.x, (double)this.maxUpStep(), movement.z), var2, this.level(), var3); - // Vec3 var10 = collideBoundingBox(this, new Vec3(0.0, (double)this.maxUpStep(), 0.0), var2.expandTowards(movement.x, 0.0, movement.z), this.level(), var3); - // if (var10.y < (double)this.maxUpStep()) { - // Vec3 var11 = collideBoundingBox(this, new Vec3(movement.x, 0.0, movement.z), var2.move(var10), this.level(), var3).add(var10); - // if (var11.horizontalDistanceSqr() > var9.horizontalDistanceSqr()) { - // var9 = var11; - // } - // } - - // if (var9.horizontalDistanceSqr() > collidedMovement.horizontalDistanceSqr()) { - // return var9.add(collideBoundingBox(this, new Vec3(0.0, -var9.y + movement.y, 0.0), var2.move(var9), this.level(), var3)); - // } - - - let mut var9 = collide_bounding_box( + let mut hypothetical_new_position + = collide_bounding_box( &Vec3 { x: movement.x, y: max_up_step, @@ -95,7 +82,7 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics) world, entity_collisions.clone(), ); - let var10 = collide_bounding_box( + let step_up_position = collide_bounding_box( &Vec3 { x: 0., y: max_up_step, @@ -105,31 +92,31 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics) world, entity_collisions.clone(), ); - if var10.y < max_up_step { + if step_up_position.y < max_up_step { let var11 = collide_bounding_box( &Vec3 { x: movement.x, y: 0., z: movement.z, }, - &entity_bounding_box.move_relative(&var10), + &entity_bounding_box.move_relative(&step_up_position), world, entity_collisions.clone(), ) - .add(var10); - if var11.horizontal_distance_sqr() > var9.horizontal_distance_sqr() { - var9 = var11; + .add(step_up_position); + if var11.horizontal_distance_sqr() > hypothetical_new_position.horizontal_distance_sqr() { + hypothetical_new_position = var11; } } - if var9.horizontal_distance_sqr() > collided_movement.horizontal_distance_sqr() { - return var9.add(collide_bounding_box( + if hypothetical_new_position.horizontal_distance_sqr() > collided_movement.horizontal_distance_sqr() { + return hypothetical_new_position.add(collide_bounding_box( &Vec3 { x: 0., - y: -var9.y + movement.y, + y: -hypothetical_new_position.y + movement.y, z: 0., }, - &entity_bounding_box.move_relative(&var9), + &entity_bounding_box.move_relative(&hypothetical_new_position), world, entity_collisions.clone(), )); |
