wareya / GodotStairTester

Test project for stair-stepping in Godot 4
Creative Commons Zero v1.0 Universal
17 stars 2 forks source link

Fix glitches by increasing safe margin #1

Open elvisish opened 1 year ago

elvisish commented 1 year ago

Hopefully this will be useful to anyone getting stuck in the glitch testing areas, I've used a bigger safe-margin in 3.x with Godot Physics and I don't ever get stuck in geometry any more, basically the default is just too small for GP (and yes there's jiggling, but that's because GP is broken) image

wareya commented 1 year ago

Increasing the safe margin has the side effect of making it more likely to get stuck in a situation where the collision system thinks the edge of the stair is rounded instead of flat, requiring the skipping hack to be enabled in more situations:

https://github.com/wareya/GodotStairTester/assets/585488/37db1ca7-ff4c-4c3f-95f8-2c11a8d1b1b2

The safety margin is purely good for rigid bodies, but for kinematic bodies / character bodies it's a tradeoff.

elvisish commented 1 year ago

Increasing the safe margin has the side effect of making it more likely to get stuck in a situation where the collision system thinks the edge of the stair is rounded instead of flat, requiring the skipping hack to be enabled in more situations:

2023-10-03_12-13-24.mp4 The safety margin is purely good for rigid bodies, but for kinematic bodies / character bodies it's a tradeoff.

Actually I only ever use KinemeticBody in Godot 3.x and it's been fine, but I haven't used your stair-stepping approach with it so it might have some issues as you say. I should actually test Jolt physics with your stairs, see how it performs...

Edit: wow, it's actually impossible to get stuck with Jolt physics:

https://github.com/wareya/GodotStairTester/assets/16231628/1ffffa7e-09d7-4299-8faa-cab29088bac7