Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Hey, that's me!

Yea it's an AddForce on every frame.

The player's rigidbody has the physics engine gravity turned off and rotations frozen so the physics doesn't mess with our character without our permission.

The math is super straight forward:

Get a normalized vector from planet to player (player pos - planet pos), and do the AddForce on the rigidbody using the gravity vector * -gravity force.

Then you just align the transform's up vector to the gravity vector and multiply in the planet's rotation to add the planet's rotation to it. (Though I never rotated the actual planet.)

 Done!