I’m trying to create a planetary gravity simulation, and while I’m happy with my progress on the movement of parts and models, I’m having some trouble integrating the player and player movement into the system.
The game doesn’t use the default workspace gravity, parts are instead pulled towards large spheres, or planets. While the force that actually does the pulling is implemented and applies to the player, it causes problems as the player controller constantly tries to align the orientation of the player along the global Y axis, instead of against the force of gravity. Likewise, the direction that the player moves in using WASD is along the global XZ plane instead of the player’s current orientation on the planet.
I don’t think I’m able to modify the default scripts that control player movement, and I haven’t made any custom player controllers before, so I’m a bit lost on what to do to fix this.
So, to sum it up, I’m looking for is a way to change which way the player tries to align itself by default. I know which direction I want to align it in, I just don’t know how.
Player movement should be as simple as getting the lookVector and RightVector muliplied by speed.
local look = humanoidRootPart.lookVector
local right = look:Cross(Vector3.new(0,1,0)
local speed = 10 -- some scalar value
--# The characters velocity should be as follows
char.Velocity = look*speed + right*speed
Thank you for showing me this post. This controller is exactly what I’m looking for and then some. The only problem now is that while the post and comments say that it’s open source, I can’t seem to find the actual controller that I can put into my game anywhere. Am I missing a link somewhere?