Recently, I’ve been working on a custom physics-based 3D first person character controller. It currently works on planets that move quickly, but the player doesn’t notice that they are moving because everything works relative to the surface velocity and orientation. I’ve been encountering an issue recently with rotating the player with the surface.
Currently, I freeze the rotation of the player’s rigidbody and apply the rotation myself so that they do not spin out of control when brushing against a wall. To apply this rotation, I’ve used MoveRotation in LateUpdate() for a smooth result that doesn’t interfere with the rigidbody’s interpolation. This worked fine for some time, until recently when I tried to make a planet with multiple axis of rotation, spinning quickly. I noticed that the player was sliding, which is to be expected since they are going to experience centrifugal forces. The issue is that, when I disable the code that rotates the player with the surface (specifically the line with Rigidbody.MoveRotation() on it) the player stayed completely still, just like how I want it to be.
So, I tried different approaches. Setting the rotation caused issues with the interpolation, and moving it to the fixed update caused the player to slide again. (The physics material has friction at the maximum) For the past few days I’ve been trying to figure out a way I can set the rotation of the player to follow the surface smoothly, but also have them not slide around. I’m honestly really desperate, but also curious to hear if anyone else has encountered this issue or has experience with creating a character controller that functions on planets / moving surfaces in general. I can provide code samples or some video if necessary.
Thank you for your time.