Edge sensors: slide over the edges of floors, walls and ceilings #3
Loading…
Reference in a new issue
No description provided.
Delete branch "floor-edge-drop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Near the edge of any surface, pressing into that surface slides the slime to the edge, rolls it over the corner and onto the side of the platform.
RayCast2Dnodes under anEdgeSensorspivot are rotated to point into whatever surface the slime is on, one a short way to each side. When one stops touching the surface, there's an edge in range on that side. You can see them in game with Debug → Visible Collision Shapes.Sensor range
edgeSensorRangeis exported, so you can tune it in the Inspector. The default is 24, picked from a headless sweep (slime radius 10):Other changes to the wrap code
_begin_wraptakes the normal of the surface to end up on, works out the sprite rotation from it, and can now end on a ceiling.move_and_slide(), sois_on_floor()/is_on_wall()/is_on_ceiling()describe where the slime ended up, not where it was before the wrap.Testing
Tested headless in Godot 4.7.2 with scripts that build platforms, spawn the player and simulate input. All 18 cases pass:
test_level.tscnloads and runs with no errors.Still worth a playtest for feel. Headless tests can't tell how it looks.
🤖 Generated with Claude Code
Slide over floor edges onto the wall below when pressing downto Edge sensors: slide over the edges of floors, walls and ceilings