Smoothly wrap around ceiling lips and wall tops #2

Merged
SnekInAScarf merged 2 commits from smooth-edge-wrap into main 2026-10-31 20:47:22 -05:00
Owner

What this does

Going around an edge used to depend on the round collider happening to slide around the corner, so the result changed with exact positioning. Now the slime finds the corner and swings around it on a smooth quarter circle at crawling speed, and the sprite rotates along with it.

  • Ceiling lip → wall above: while hanging on a lip, press up and the slime swings up onto the side of the platform. If you're already holding up as you crawl off the edge, it goes straight from the ceiling onto the wall without stopping.
  • Top of a wall → floor on top: climbing up past the top of a wall swings the slime over onto the top of the platform instead of popping off.
  • Input forgiveness: tapping up up to 0.15s before reaching a lip still counts (CLIMB_INPUT_BUFFER).
  • Fallback: if the corner can't be found, or something blocks the spot where the swing would end, it falls back to the existing behaviour.

How it works (Characters/player.gd)

  • Raycasts find the corner: one to the platform's bottom or top surface, one to its side.
  • A shape query checks the end of the swing is clear before starting.
  • _update_wrap moves the slime along the arc. Physics and input are paused for the swing, which takes about 0.1s with the current radius and speed.
  • When the swing ends, the slime is set to wall-sticking or left to land on the floor. After a lip wrap, the direction you were still holding doesn't start the unstick timer until you release it.

Testing

Not run in Godot yet. Please check:

  • Crawl off a ceiling edge, then press up: a smooth swing onto the wall above, and holding up keeps climbing.
  • Crawl off a ceiling edge while already holding up: goes straight around without stopping.
  • Climb up a wall past its top: swings onto the top and you can walk away.
  • Both directions (left and right edges) for both cases.
  • A lip with something directly above the wall, or a wall top with a low ceiling over it: no clipping, just the old behaviour.
  • Standing on the floor against a wall and pressing up still climbs normally.

The corner-finding assumes the player's collision shape stays a CircleShape2D, and that the platform edges are square corners.

🤖 Generated with Claude Code

## What this does Going around an edge used to depend on the round collider happening to slide around the corner, so the result changed with exact positioning. Now the slime finds the corner and swings around it on a smooth quarter circle at crawling speed, and the sprite rotates along with it. - **Ceiling lip → wall above:** while hanging on a lip, press up and the slime swings up onto the side of the platform. If you're already holding up as you crawl off the edge, it goes straight from the ceiling onto the wall without stopping. - **Top of a wall → floor on top:** climbing up past the top of a wall swings the slime over onto the top of the platform instead of popping off. - **Input forgiveness:** tapping up up to 0.15s before reaching a lip still counts (`CLIMB_INPUT_BUFFER`). - **Fallback:** if the corner can't be found, or something blocks the spot where the swing would end, it falls back to the existing behaviour. ## How it works (`Characters/player.gd`) - Raycasts find the corner: one to the platform's bottom or top surface, one to its side. - A shape query checks the end of the swing is clear before starting. - `_update_wrap` moves the slime along the arc. Physics and input are paused for the swing, which takes about 0.1s with the current radius and speed. - When the swing ends, the slime is set to wall-sticking or left to land on the floor. After a lip wrap, the direction you were still holding doesn't start the unstick timer until you release it. ## Testing Not run in Godot yet. Please check: - [ ] Crawl off a ceiling edge, then press up: a smooth swing onto the wall above, and holding up keeps climbing. - [ ] Crawl off a ceiling edge while already holding up: goes straight around without stopping. - [ ] Climb up a wall past its top: swings onto the top and you can walk away. - [ ] Both directions (left and right edges) for both cases. - [ ] A lip with something directly above the wall, or a wall top with a low ceiling over it: no clipping, just the old behaviour. - [ ] Standing on the floor against a wall and pressing up still climbs normally. The corner-finding assumes the player's collision shape stays a `CircleShape2D`, and that the platform edges are square corners. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SnekInAScarf added 1 commit 2026-10-31 14:41:27 -05:00
Instead of relying on physics to slide the round collider around a
corner, find the corner with raycasts and swing the slime around it on
a quarter circle at crawling speed, rotating the sprite along with it.

- Hanging on a ceiling lip + up: swing onto the wall above.
- Climbing up past the top of a wall: swing over onto the floor on top.
- Tapping up up to 0.15s before reaching a lip still counts.
- Falls back to the old behaviour if the corner can't be found or there
  is no room at the end of the swing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 1 commit 2026-10-31 14:46:09 -05:00
The wrap ended with the slime level with the corner and WRAP_MARGIN away
from the wall. The wall stick push only covers ~0.33px a frame, so it
often didn't touch the wall on the next move_and_slide, stopped sticking
and fell.

- After the arc, carry on straight up the wall by the radius (or onto the
  platform for wall tops) so the slime ends flat against the surface.
- Close the remaining gap with move_and_collide when the wrap finishes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf merged commit 0f24145f49 into main 2026-10-31 20:47:22 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: SnekInAScarf/SlimePlatformer#2
No description provided.