qhdwight / bevy_fps_controller

Source engine inspired Bevy FPS controller plugin
https://crates.io/crates/bevy_fps_controller
Apache License 2.0
182 stars 18 forks source link

Look into Rapier Character Controller #20

Open qhdwight opened 1 year ago

qhdwight commented 1 year ago

https://rapier.rs/docs/user_guides/bevy_plugin/character_controller/

FastestMolasses commented 9 months ago

Hey, still looking to add this? I implemented a basic version and was able to remove your auto step code. The one provided works really smoothly. There are some things that I didnt replace with the controller such as the ground casts, but this is at least a good stepping stone if you want to incorporate it. Let me know and I'll make a PR!

qhdwight commented 9 months ago

Oh definitely - I remember trying to implement it myself a few months ago and it was not so smooth.

Feel free to open a PR and I can take another look.

qhdwight commented 8 months ago

Starting some work on the rapier-character-controller branch

FastestMolasses commented 8 months ago

Thanks for reminding me! Ill commit my changes to that branch sometime today!

qhdwight commented 8 months ago

Think we need to use effective_translation somehow from KinematicCharacterControllerOutput.

For example when the player runs into a wall they should not keep all of their velocity. It does have some weird side effects though that cause jitter, especially when jumping against a wall.

FastestMolasses commented 8 months ago

Increasing the offset removed the jitters but it still doesn't let the player slide across the walls when moving. I also notice that sometimes the velocity doesn't go down to zero when moving slowly and there's an extra weird force (?) when trying to step over a step. Will try to help debug these issues.

FastestMolasses commented 8 months ago

So after some research, it looks like the way collision detection works in the rapier character controller is causing the player to hang by setting it's velocity to 0. This is most obvious if you try jumping and hitting your head on the ceiling of something. With your current character controller, the player will immediately fall back down. With the rapier one, the player will stick to the ceiling for a second before falling back down. Currently I dont know if this can be solved without making a PR to rapier. Will continue to look into it.