Constraining 2D movement to polygon surface

Hi guys,

I'm looking to create a 2.5D platformer in which there are certain platforms that the player "sticks" to, and can walk on all sides of. Effectively I want to use the normals of these platforms to tell the player character which way "up" is, and to constrain his movement to these platforms so that he can move left or right all the way around them without falling off.

The problem is that I'm new to unity and I have absolutely no idea where to begin in making this work.

For testing purposes, I'm using a rigid body sphere to represent the player character. If anyone can offer advice to help me get such a sphere to "stick" to a polygon surface and roll around it's edges, that would be very much appreciated!

The following diagram demonstrates what I'm trying to achieve, where the black object is the platform polygon, the blue object is the player character, and the lighter blue objects are example positions the player character can roll around to, ignoring global gravity, etc.

alt text

Any help or advice at all is welcome, no matter how small! I really just have no idea where to begin, and this seems like the kind of thing that other people must have done before.

Thanks in advance,


I'd suggest that for these sections you turn off the global gravity and instead apply your own. Find the edge that the ball is meant to be stuck to and apply gravity along the normal of that edge.