Wall stick/Gravity Controller

Hello again! This is now my third post regarding gravity controllers. I’ve been playing around with them on and off over the past two years. I’ve learned a lot and as a result have gone through a number of iterations that vastly improve the techniques used.

Now what I’m posting today is actually two separate controllers. They both have different use cases so please do read the whole post before deciding which one you’d like to use in your game or play with, etc.

Okay, so on with the show! :partying_face:

Wall stick controller

Update [12/06/20]: See the most updated version of the wallstick controller here:

If you’ve seen my previous post(s) this controller will be familiar to you. The concept is that we have a de-rotated world transparent and way off in the distance that we traverse with a fake character. We then replicate that fake character’s movement over to our real character which gives the appearance of defying gravity and walking on walls and so forth.

Now, the largest change here from my previous iteration (aside from an overall cleanup and simplification of some math), is that we no longer use body movers. Originally the reason I chose to use body movers was because they replicate nicely. However, what body movers do not do nicely is move fast enough to keep up with the physics that affect parts and so forth. So now we use CFrames and we replicate our character movement ourselves.

This change allows for much greater accuracy when it comes to standing on any moving platform.

You can run around on moving objects that are either CFramed or being moved by a body movers:

You can stand on a plane with another character driving it:

Heck, you can even ride on a part that’s being flung across the map with physics

Now it does have a couple issues that I’m aware of, but they’re pretty minor.

  • It’s not really well defined when the player falls off the map so sometimes you just get stuck and never die (unless you reset)
  • The player can’t use seats while the controller is active. In the video above I disable the controller before sitting on it
  • The .Touched event can be a little crazy when registering the character. I suppose technically because the character is being cframed sometimes this can cause repeat firing or no firing at all.
  • The popper cam isn’t quite perfect. I’m kinda stumped on this one to be honest. It works pretty well, but especially when on moving platforms is kinda clips through walls a little bit. For now I’m blaming it on floating point error, but it’s probably not that :stuck_out_tongue_closed_eyes:.
  • Probably the biggest one: It doesn’t work with terrain!

You can also use this version which fixes a lot of the camera issues. I’m not sure why the place has such a large number of dislikes, but it’s arguably better than the above in every way.

Gravity controller

[Update 1/13/20]: See the most recent version of gravity controller here:

This controller is true to its name in that it controls gravity and that’s about it, it doesn’t have any of the other wacky physics abilities of the other controller, but it does handle certain things better such as the ability to walk on curved surfaces and yes, the ability to walk on terrain.

Now the main downside to this controller is that we lose all the benefits of humanoid state tracking. I added a very very simple state tracker for animation purposes, but it really only does the bare minimum.

Again, it does have some issues of its own:

  • Again, if a player falls off the map you may end up falling forever
  • The player can’t use seats when the controller is active
  • As mentioned there’s no state tracking when using this controller.

Final words

Finally, I want to make two things very clear.

First, I have no intention to support these controllers going forward. If there’s a bug you’ll have to figure it out. If Roblox pushes an update that breaks these bad boys, guess who has to fix this sucker… you! :point_left: If you send me a message regarding any of these problems I will not respond to it.

Secondly, and this is probably unsurprising, I don’t intend to make another iteration of these controllers. You’re more than welcome to build upon my work and share it (I’d certainly enjoy that), but I think I’m done with these. If I do make another iteration I don’t intend to release it.

That’s all folks.

Hope you enjoy and make some cool stuff with this! Cheers :+1:

1106 Likes
[Release] Custom character controller
Gravity controller
Character walking upside down
Gravity Controller (NEED HELP)
Gravity type game
Toggle gravity controller
Would "insect legs" in Roblox even be possible?
What is the best way to create directional gravity?
How to weld a player to an elevator?
Wall Stick Spawn Issues
Gravity controller bug
Running around a sphere
What is the best way to script a train?
Player standing on a part moved by Velocity & BodyForce?
How would I make slope tilting?
Keep player smooth on moving platform?
How would I go about changing the player's target up vector?
How can I make player walk on walls?
Gravity change on specific part
Help with wall sticking for platformers
How can I have my character "latch" onto certain parts?
Attempted To Index Nil with "Connect"
Smooth player standing on the train system?
Random Obby Generation
How do I make a raycast go to exactly the bottom of the player's feet?
I made a sonic gravity controller...What do you guys think?
How can I make a player walk on walls?
Open sourcing my "broken" game to make it easier for people to see what's wrong with it
CFrame glitching out when jet points straight up
Anti-gravity game
Learn to Script / Learn to Code in 5 Steps
Trying to tween bodygyro and body position?
Spherical Pathfinding
How a wallrun script works?(explaination needed)
Custom character model sliding down wedges
How do i make a wall running feature
How to make the player attracted to the sky instead of the ground?
Does anyone know how to make a Wall Climbing system like in Find Everything?
Planetary Gravity using Gravity Controller By @EgoMoose?
Checking Vector3Value.Value Accurately
Regarding egomoose wall stick controller
[solved] How to make camera rotation offset?
Walking/moving parallel to every surface of a part/model
Best way to do this?
Elevator making player bounce/shake everywhere as it's moving
Aircraft fall off carrier deck when moving?
How would I go about making a player "stick" to a wall
Streaming Enabled prevents local parts from running physics
How to make a toy race car system
[canceled] Hiring a scripter for an animated interactive story game!
How to invert player controls?
Help with walking on a ceiling
How would I make Planetary Gravity?
Wall Run Along a surface
Align Orientation does not allow rotating my character on the Z or X axis
I want to make a small Gravity Controller for specific parts
Help With Realistic Zero-Gravity/Microgravity
How would I make someone be able to walk on walls/roofs?
Gravity Flip Help Needed
How should I approach creating a walk on walls script?
How to change the gravity direction
How to change the gravity direction
Match the camera Orientation XZaxis to character Primary Part
How do I make players "stick" to a part?
Modified GravityController by EgoMoose breaks upon respawn
How would i make my character stay put when map is flying
Upgraded EgoMoose's Wall Stick/Gravity Controller : Terrain Physics, Normal Animate
How to make camera rotate with character?
Camera Tilting When Character Is Tilted On A Surface
How do i make planet walking on sphere
Player *sometimes* cannot Jump while Sprinting
Can I make Robloxian climb ceiling stairs?
Weirdest bug i have every seen
How do i get this?
What would be the best way to make Controlled Gravity?
How do I use gravity controller to make gravity go a certain direction?
How can I change gravity for characters like in some levels of silhouette? (If you have source code please tell me, or how I could pull this off!)
Making the camera pan relative to the characters orientation
Detecting if a Player is near Part(s) and Terrain
Does anyone know how to flip gravity?
Unable to Jump *Sometimes* - Issues with ControlModule; TouchJump Modules
How to make part/model move you along with it
Wall Stick Spawn Issues
Ring Gravity, velocity and cframe angles
Simulated Gravity Force
Moving a part while accounting for collisions
How to make gravity control?
How can you make a cartoony unrealistic movement on a sphere?
Space game mechanic help
How to check if a Player is holding Space?
What ideas sound interesting for obby levels?
Player Unable to Jump
Custom Character Controller Help
Custom Character Controller Help
Help to make the player jump
Trouble with seated player physics with rapid CFrame changing and EgoMoose's Wallstick controller
How can I add a full rotation around rounded parts combined with a tilt system
Player Not Sticking To Part Moving With BodyPosition
How to disable camera rotation limits
How to change Characters Center of gravity
Help with creating artificial gravity relative to a ships floor
Making a player stick to a block
Make Part toggle feature from a separate script - (Example Shown)
BodyForce Gravity not working
BodyForce Gravity not working
Does anyone know how to script a subway realistic? It would be nice that the subway will work
Problem With Wall Run Script
How to make artificial gravity?
Need help with moving part
How to stick player to the wall?
Is their a way to Warp What the Player Is Walking on?
How do I let players walk on walls?
Need new level ideas!
Looking for advice and resources on creating non-stationary reference frames

One of the most nauseating creations i’ve ever seen, yet also the most brilliant!
Having tried to create as you called a ‘wall stick’ controller in the past, I feel a high quality, open source one could inspire so many innovative game ideas!

Always love your posts since there is always something fun to keep me entertained for a while!

95 Likes

This is absolutely amazing and I’m definitely going to use it for something. Although I ran into an issue with the gravity controller that wasn’t specified: Objects that are CanCollide false still effect your gravity.

23 Likes

Yes, that’s because I lazily threw together the method that sets the normal. In my case I just did a ring-like raycast around the player. But for your case you may want to ignore any objects a ray hits that are not can collide or you may not even want to use raycasting at all. You only need to have the method return a new gravity up vector.

34 Likes

Thanks! I got it working after a bit of trial and error.

12 Likes

Again, if a player falls off the map you may end up falling forever

For this problem with the Wall stick controller.
Could you not just detect if the player is falling and use a large downward raycast?
If the raycast doesn’t hit anything and the character is falling for a period of time you could kill the player.

16 Likes

Yes you could do that if that’s an acceptable enough check for you.

11 Likes

First Person/Shift Lock also seem to have issues:

You also can’t jump very far if you look down with your camera:

25 Likes

Both those problems should be fixed now.

The jump was an interesting one (not quite sure why the fix worked, but it did). As for the first person/shift lock, it’s not an exact replica. I had to use a body gyro to spin the character b/c it seems most of that code is under the hood.

38 Likes

You are the best! Thank you for this.
Very cool.

18 Likes

These are great! Thank you for open sourcing these. I’m sure these will lead to loads of cool ideas/games/concepts and the like.

That said, regarding your Gravity Controller if I wanted to modify this so that rather than falling from a ledge or corner when walking off of it, the player instead “snaps” to walk on the surface below/behind them instead, how would I go about that?

I have a means of detecting the surface desired to move to and have tried snapping the character’s hrp CFrame to the desired angle/location on the surface - however the player snaps back to their gravity/orientation before being moved and proceeds to fall, as if the controller isn’t updating their gravity. Any insight into what would be best to look into changing/modifying would be massively appreciated.

15 Likes

I love the Gravity Controller ! I’m creating a Roblox game with this, and i’m wondering how can i disable and enable the Gravity Controller with a part Touched script. Can you help me ?

14 Likes

Possibly by having a instance.new part that is the controller, and have it so on the touch it creates the part in the player.

10 Likes

Can you give me more details and give me more instructions? Because i don’t completely understand the module.

8 Likes

I found a way for disabling the controller, but when i enable it again, by doing
Controller = GravityController.new(game.Players.LocalPlayer) it doesn’t work and keep the default roblox gravity.

9 Likes

Is it possible to whitelist parts so that players can stick on only some parts?

11 Likes

Yes, absolutely. I’d recommend doing that in the method that sets/returns the normal/part. Just use raycast with whitelist or something similar.

18 Likes

Our boi back with another studio miracle.

love what you’re doing.Keep up :heart:

12 Likes

Also I downloaded the game and made a hangout style of it.

I also gave you credit for the physics.

14 Likes

I absolutely love this! If you can get the right people, you can remake super mario galaxy :smile:

28 Likes