added basic gravity function