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

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!

Gravity controller

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:

287 Likes

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!

35 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.

7 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.

8 Likes

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

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.

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

2 Likes

First Person/Shift Lock also seem to have issues:

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

7 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.

14 Likes

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

5 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.

1 Like

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 ?

2 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.

2 Likes

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

2 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.

1 Like

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

2 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.

4 Likes

Our boi back with another studio miracle.

love what your doing.Keep up :heart:

4 Likes

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


I also gave you credit.For the physics.

5 Likes

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

10 Likes