Hello developers!
Just recently I decided to make my own planet game with RPG progression, randomly generated solar system and ship building to try out something new, as all I’ve been working with lately were fighting games only.
But now on the very beginning massive issue struck me:
Core roblox scripts tend to fix character rotation not tiltable, meaning that i cant simply force player to rotate along planet surface and expect smooth result in physics. As character closes itself to 45* angle or above of surface, it doesn’t tilt at all but also makes physics work in weird way, pushing character back to the top of the planet.
I’ve tried searching on forums and all I found were already made modules with no explanation of how they work at all. Investigating modules I found way too confusing though… Then I tried asking ChatGPT to help me find issues, but seems like chat lacks knowledge about core scripts to some extend, which makes it not enough to help me out steadily.
Now here I am on dev forums asking people for some help.
Could you please help me find out more about causes and fixes for my situation? What core scripts should I try to edit etc.
Really hope to get any help related to this!
Here is my place with all current attempted changes:
Disabled humanoid auto rotate
Forcing player rotation physically via AlignOrientation
Changed ControlModule inside of PlayerModule to calculate movement according to planet surface up Y and not world up Y
I don’t want to use any pre-made controllers but learn myself how to make one, that’s the interesting part.
And I’ve noted already how I find other’s modules illegible for me.
This is a complicated problem to which I only have ideas of how to solve. The two main ideas that come to mind are:
First solution would be to make custom characters. I think the behaviour of humanoids is coded in the engine directly and cannot be modified enough for your use case. However, the character controller, and the camera module, are written in lua, and automatically parented to PlayerScripts when the player spawns. You can copy it, and paste it into StarterPlayerScript to fork and modify it.
The character controller calls Humanoid:MoveTo() to make the humanoid walk. You could bind into that to move your custom character
Other solution would be to move the whole world around the player. The player would stay at 0, 0, 0, and everything else would move around. This effect would have to be done on the client, as each client will see something different, and by default, other players will all be shown as being at 0, 0, 0. This solution is particularly good for another reason though, and that is that floating point precision errors aren’t a problem anymore as the character is always at the origin (which is commonly an issue with space type games, due to the large distances)
This solution might also involve modifying the character controller
Rotating whole world is a terrible solution, especially as this game will be multiplayer one.
Also about custom player handler. I did start making new one, but even so, when I completely removed PlayerManager (well technically just copy-pasted scripts in starterplayerscripts and made them empty), humanoid STILL TENDS TO FORCE LOCK TILTING. Currently trying to find what specific state of parameter does this, and if I won’t be able to find it, I have little to no idea what I should do now…
I tried to force character rotation by affecting CFrame though, but after tilting more than 80 degrees relatively to world up vector, player character just glides down to the bottom of the planet, flies out of atmosphere and enters “fling state”
Again, try @EgoMoose’s controller.
He designs them as tutorials so does an excellent job of explaining how the scripts work with notes in them.
It would teach you how to do it effectively, and if you find other ways with newer features like the Character Controller then you can modify what you learned from his code to better fit your game.
I became friends with EgoMoose years ago. I’ve always found his scripts to work really well, be very efficient, and have insanely descriptive notes in them designed to teach people with only a very basic knowledge of scripting.
I hope you didn’t mean it that way, but these comes off a bit rude / aggressive (at least from my perspective). Just keep in mind both these responses are on-topic and have valuable suggestions / information. It may do you well to acknowledge their responses with a bit more grace even if they’re not the exact answer you’re looking for.
As for your question…
It seems like thus far your main issue is with the humanoid. Unfortunately, it is impossible to disable the humanoid forcing itself upright while also retaining all the forces, sensors, and state handling that they normally provide. So in short, you will have to set Humanoid.EvaluateStateMachine = false and write your own character controller.
There will be a number of parts to this:
Calculating the gravitational forces
Calculating the movement forces (including stuff like standing on a spinning platform)
Calculating the state since you presumably want to animate the character and have sound etc.
Additionally, depending on how you want your game to work you may also need to invest time in a camera controller that rotates with the character.
Hope that clears some stuff up for you. Good luck!
Yes, it’s a lot of work to break out of Roblox’s “+Y is up” world. You have to apply all the forces and constraints in your tilted frame of reference because Roblox’s Humanoid is hard-coded to only apply walk/run force in the XZ plane, to only jump in the +Y direction, and to only be able to climb ladders and trusses in the world Y-axis direction.