So I’m having an issue with how my project works.
In it is a miniature planet that has gravity using newton’s formula of m1*m2/r1^2 * G which is just math stuff. I use this instead of line forces as I’m given more control.
The issue arises from the player. They’re rotated so that their feet are always pointed towards the planet, but at the poles the camera swings violently around which is annoying and I don’t know how to fix this.
The other comes from the player weirdly sliding around the sphere. I would think that’s just the gravity making stuff float towards the closest possible point but it slides uphill and other directions also, eventually flinging the player away randomly. I thought turning up the friction of both objects would stop the sliding but it didn’t.
I don’t have any idea how the camera problem is happening, I am using CFrame.lookAt() for it to point though, whilst rotating the player body and camera.
Camera script:
Gravity script:
Video of both problems at hand:
Instead of the camera flipping violently like it does in the video when reaching the poles, I need it to just keep the player moving forward like how it would work in real life. If anyone has seen the game Outer Wilds, it would be like that. I also need the player to not fling when on the planets for seemingly no reason (the end of the video is mostly not my input, just trying to stop randomly accelerating).
The character collision is just a ball on the bottom of them. Switching it to a box stops the sliding but the flinging still happens and walking on the surface causes a lot of bumping.