Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

wow i'm really happy that you like it! 
Actually gravity is pretty simple. In the real world, the large mass attracts the smaller one towards its center of mass.  That means, Earth applies force to everything on the planet, the direction of which is towards the center of the planet. 

If we find a direction for force, we can create faux gravity, and this direction can be found by (planetPos-objPos).Normalize ! (end point - start point, then normalize) Instead of calculate the mass things, I multiplied this vector with a gravityModifier float and used this new vector as a gravity force on the player.

In short I applied a constant force to the character, the direction of which was towards the middle of the planet. I hope that's help ^^

Always found this somehow complicated... in fact I searched this on the net a while ago but couldn't really understand it. If you'd have a chance for a more in dept explanation, perhaps on discord, I'd be glad