setGravity() moved up from below and is now private.  setLocalGravity() is called whenever a script updates MyAvatar.gravity and will set the motion behavior flags accordingly.