PrismarineJS / prismarine-physics

Provide the physics engine for minecraft entities
MIT License
35 stars 39 forks source link

1.18 Physics Issues #67

Open BattleDash opened 2 years ago

BattleDash commented 2 years ago

1.18 made changes to physics that cause the bot to get stuck due to the server's anticheat disallowing movements and rubberbanding the player. I made a PR on pathfinder because I assumed it was an issue with that library, but it turns out it works fine on lower versions and is an issue with 1.18 physics.

An easy way to observe this is to get pathfinder to slide across blocks during diagonal movements like so. In the current implementation, it will get stuck forever. It can also happen when jumping up blocks.

Karang commented 2 years ago

The collide function seems to be quite different from previous versions:

But also simpler.

dement6d commented 2 years ago

here are 2 video examples of this happening to me too https://youtu.be/7enDyUwmvP8 https://streamable.com/3pibu0

Vakore commented 9 months ago

A hacky fix for this issue is changing line 118 of prismarine-physics's index.js to const blockBB = new AABB(shape[0] - 0.01, shape[1], shape[2] - 0.01, shape[3] + 0.01, shape[4], shape[5] + 0.01) if this has not been fixed yet(from complaints I've heard from other users it seems to have not been fixed yet), however if the bot is teleported directly next to a block it'll be stuck unless it is mined/teleported again, though unless you're doing stuff with enderpearls/lots of teleporting directly next to blocks it should work.

It seems to happen at x=-2, x=-32, etc. but not at x=-16 or x=-8, could be a floating point issue? Oddly adding 0.01 to playerhalfwidth does NOT fix this issue.