From f9f196d8c6770c97bbc90149ee9e41f6ec426091 Mon Sep 17 00:00:00 2001 From: SnekInAScarf Date: Sat, 31 Oct 2026 17:24:11 -0700 Subject: [PATCH] Fix falling off the wall right after a floor-edge wrap on right ledges When a wrap finishes, Godot still thinks we're on the floor we started from. On the finishing move_and_slide it then snapped us down onto it (floor_snap_length) and counted the wall we were pushed into as floor (floor_block_on_wall), so we landed as "on floor", stuck to nothing, and fell the next frame. It only happened on right-hand ledges because of how the contact lined up. Turn both off for the finishing move unless the wrap ends on a floor. Co-Authored-By: Claude Opus 5.5 --- Characters/player.gd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Characters/player.gd b/Characters/player.gd index a39fabb..8b6c7ef 100755 --- a/Characters/player.gd +++ b/Characters/player.gd @@ -530,7 +530,18 @@ func _update_wrap(delta: float) -> void: # Done with move_and_slide so is_on_floor()/is_on_wall() are up to date # instead of still describing where we were before the wrap. velocity = -wrapOntoNormal * (WRAP_MARGIN + 1) / delta + # Godot still thinks we're on whatever floor we were on before the wrap, so + # it would try to snap us down onto it, and (floor_block_on_wall) count the + # wall we're pushing into as floor. Only allow that if we're ending on a floor. + var endingOnFloor := wrapOntoNormal == Vector2.UP + var floorSnap := floor_snap_length + var blockOnWall := floor_block_on_wall + if not endingOnFloor: + floor_snap_length = 0.0 + floor_block_on_wall = false move_and_slide() + floor_snap_length = floorSnap + floor_block_on_wall = blockOnWall # Carry on at the same speed along the new surface, so leaving the wrap # isn't a sudden stop. Normal movement then speeds up or slows down from here. var exitDirection := wrapExitOffset.normalized() if wrapExitOffset != Vector2.ZERO \