I spent 10 years post doc working on this very problem. The balancing process is quite complicated, as noted by others above. There is a hierarchy of sensory inputs that are used to maintain one's balance. The most compelling is peripheral vision. In fact, the primary role of the vestibular system (organs of balance) is to stabilize the eyes during head movement so that a steady reference to the horizon is visible (personal discovery).