1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 00:55:20 +02:00

LocalPlayer: Restore 2u height sneak jump (#15015)

Fix 1: Do not consider LocalPlayer's CAO in the collision data.
Fix 2: work around the "aabbox3d::intersectsWithBox" edge-case.
This commit is contained in:
SmallJoker
2024-08-26 21:23:12 +02:00
committed by GitHub
parent 21ed680b10
commit 8109563a02
3 changed files with 20 additions and 13 deletions

View File

@@ -65,7 +65,8 @@ struct collisionMoveResult
std::vector<CollisionInfo> collisions;
};
// Moves using a single iteration; speed should not exceed pos_max_d/dtime
/// @brief Moves using a single iteration; speed should not exceed pos_max_d/dtime
/// @param self (optional) ActiveObject to ignore in the collision detection.
collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
f32 pos_max_d, const aabb3f &box_0,
f32 stepheight, f32 dtime,
@@ -73,7 +74,11 @@ collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
v3f accel_f, ActiveObject *self=NULL,
bool collide_with_objects=true);
// check if box is in collision on actual position
/// @brief A simpler version of "collisionMoveSimple" that only checks whether
/// a collision occurs at the given position.
/// @param self (optional) ActiveObject to ignore in the collision detection.
/// @returns `true` when `box_0` truly intersects with a node or object.
/// Touching faces are not counted as intersection.
bool collision_check_intersection(Environment *env, IGameDef *gamedef,
const aabb3f &box_0, const v3f &pos_f, ActiveObject *self = nullptr,
bool collide_with_objects = true);