add gravity angle & magnitude

optimized some code