godot icon indicating copy to clipboard operation
godot copied to clipboard

Fix `move_and_slide` wall slide acceleration (3D)

Open rburing opened this issue 1 year ago • 1 comments

When travel is high enough, keep the global position resulting from the move_and_collide call, and set the motion to the remainder from the move_and_collide call. This ensures travel is taken into account once, rather than twice.

This is also consistent with the other branch:

https://github.com/godotengine/godot/blob/2efbc6bfb3b4f49a6bc75b3d367cfe81eeddbf3a/scene/3d/physics/character_body_3d.cpp#L241-L242

Thanks to @Calinou for extra testing.

  • Fixes https://github.com/godotengine/godot/issues/66249
  • Fixes https://github.com/godotengine/godot/issues/74553
  • Fixes https://github.com/godotengine/godot/issues/90410

rburing avatar Apr 19 '24 18:04 rburing

For ease of reviewing: the travel is taken into account in the call

https://github.com/godotengine/godot/blob/2efbc6bfb3b4f49a6bc75b3d367cfe81eeddbf3a/scene/3d/physics/character_body_3d.cpp#L159

which passes p_test_only = false into move_and_collide:

https://github.com/godotengine/godot/blob/80c600d86b6fed05fdb35d5dd95267a8a95fe74d/scene/3d/physics/physics_body_3d.cpp#L155-L159

rburing avatar Apr 20 '24 15:04 rburing

Thanks!

akien-mga avatar Apr 25 '24 10:04 akien-mga

Cherry-picked for 4.2.3.

akien-mga avatar Apr 25 '24 11:04 akien-mga