According to general relativity, gravity is caused by the curvature of the spacetime. Mass and other forms of energy make the spacetime curved. Objects are following the straightest possible path, but because the spacetime is curved, the path appears curved to us.
Comments