How to change Movement direction?

How do someone go out changing the Direction of Movement in the level to work on the Z Axis? for Example ( the player is a ball that rolls around on the floor but when
it comes to a wall it can change it’s direction and roll up the wall )

You must to change gravity direction