dealing with moving and rotating planets

Usually I try to solve things on my own, but I’m genuinely curious as to how to approach this one

Basically, I’ve been fiddling a bit with space gameplay, similar to Outer Wilds. Which means every planet is simulated (and since the planets are kinematic (to allow for concave colliders), every fixed update they have their positions updated and all of that).

The problem I’m having is when trying to get all the relative stuff figured out. Like keeping the player completely still in relation to a rotating and moving planet. One thing I tried is storing a relative euler angles and relative position (then rotating it by the amount the planet rotates), and that works, except Unity physics is not a big fan of that (the player constantly goes through objects, etc).

Maybe make the player a child of the planet gameObject?

okay, so I figured this out

basically, instead of doing the calculations in the PlayerController script, I do them all inside the current planet, which keeps everything in sync and works perfectly.

every FixedUpdate, the player’s relative position to the planet is rotated to keep it in sync with the rotation, and the rotation of the player is updated to rotate with the planet as well

then I just set the player rigidbody velocity to be (nextPosition - currentPosition) / Time.fixedDeltaTime (for it to work well with collisions)