Spider Ball (Metroid)

I’m making a 2D side on ball game quite similar to morph ball from the Metroid games.

Everything’s going smoothly, except for one ability I want to implement. I want it to be basically the same as spider ball (while holding a button, you can climb around by sticking to certain surfaces).

The problem is that I can’t think of how to make the ball stick to / get attracted to certain surfaces.

I could have a kinematic trigger sphere attached to the player to find out which colliders are close to the player (on the “climbable” layer). But what can I do with that? Unless all climbable surfaces are made up of heaps of small colliders, I can’t just raycast at the center of each one.

I could raycast in all directions around the ball (8, 12 or more) but I don’t think that would be very reliable, particularly if there can be small platforms that are climbable.

I could have a series of trigger capsules in all directions around the ball (much like the raycasts). This would prevent it from missing small platforms but would still be limited in accuracy by the number of capsules used and would probably be quite inefficient.

Can anyone think of any other ways of doing it?

Better yet, does anyone know how they do it in the Metroid games?

I’ve got a weird solution. I mean… really weird. What if, when the ball approaches the wall, you rotate the ENTIRE world around the ball, thus reorienting gravity so that it pulls the ball into the wall. However, the player shouldn’t notice the world tilted since the camera moved with it. Much like that Hollywood trick where Gene Kelly danced his way up to and around the ceiling of a parlor room. They just flipped the entire room + camera. Same with the funky hotel room fight scenes in Inception.

Fo’ serious update: I would look into creating wall triggers that you can place along any non-horizontal surface. You can use these to prompt the Spider Ball to stop using gravity, and instead receive a gravity-like force along the wall trigger’s normal. Makes sense?