name variables in stepping up

This commit is contained in:
mat 2023-08-25 04:49:38 -05:00
parent 32eece4d37
commit c7359e5bba

View file

@ -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(),
));