Waridley / hack-and-slash

WIP Hack-and-slash game made with Bevy
European Union Public License 1.2
2 stars 0 forks source link

Character controller improvements #24

Closed Waridley closed 9 months ago

Waridley commented 9 months ago

Moves shape casting code from Rapier into this repo with some modifications.

Unfortunately, low framerates still have tunnelling issues, and this can even happen with a good computer if the OS happens to freeze for a split second at the wrong time. I'm not sure why penetrations are happening so often even with the buffer value subtracted from the TOI, and sadly the normals returned by contact_manifolds are highly variable. Sometimes this results in normals that push the player up slopes they should not be able to climb, but trying to prevent that makes it even easier for the player to fall through the world.

The issues are primarily with heightmaps, which are queried as a bunch of individual triangles. I might have to fork Rapier/Parry and add the ability to specify that normals should always be on the upper side of the triangles for heightmaps, rather than whichever side the collider is already mostly on.

There could also be some bug with my fixed timestep implementation when the rendering framerate is lower than the physics tick rate, and move_player has to step multiple times with shorter casts, but I have not been able to find it. Between that issue and the unexpected penetrations (which were happening with the built-in controller as well), I feel like it might be more of a limitation of shape casting rather than my usage of it.

Waridley commented 9 months ago

Will fix static checks later.