wareya / GodotStairTester

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

Slow speeds cause stair-stepping to fail #3

Open elvisish opened 11 months ago

elvisish commented 11 months ago

I've had this trouble with other stair-stepping solutions, for some reason if the movement vector is too short the stair-stepping kinda misses and just slides along the slope:

https://github.com/wareya/GodotStairTester/assets/16231628/4e4da3e6-b927-47c1-bd57-72c9ed47e580

wareya commented 11 months ago

This is a problem with how the collision margins in Godot work. When you run into the bottom step, you're actually a few fractions of a unit away from it, because of the collision margins. Then, when it looks for the stair step, it only advances by the velocity times delta, which can be less than the collision margin, so there's no floor underneath it.

The current workaround for this is enabling the "Skipping Hack", which tries moving by a fixed distance if moving by the velocity distance fails.

elvisish commented 11 months ago

This is a problem with how the collision margins in Godot work. When you run into the bottom step, you're actually a few fractions of a unit away from it, because of the collision margins. Then, when it looks for the stair step, it only advances by the velocity times delta, which can be less than the collision margin, so there's no floor underneath it.

The current workaround for this is enabling the "Skipping Hack", which tries moving by a fixed distance if moving by the velocity distance fails.

Thanks, I should mention this actually doesn't happen really with Godot Physics, it seems to mainly happen with Jolt, which is weird as Jolt should be more precise

wareya commented 11 months ago

It happens with Godot Physics too but only if you increase the collision margins.

elvisish commented 11 months ago

It happens with Godot Physics too but only if you increase the collision margins.

Ah, I haven't adjusted those, I wonder if Jolt can be adjusted so it works similarly? (I haven't worked much with Jolt tbh, though it seems like a good alternative to GP even at this stage)