[Example Source] Smooth Wall-Walking "Gravity Controller" from Club RAVEN

Given the recent interest in being able to walk around on variously-oriented surfaces, I thought I’d make my system available to play with. This character controller has been in use in Club RAVEN’s Anti-Gravity lounge since the summer of 2017, so it’s not all state-of-the-art code, but I did update it recently to be Rthro-friendly. The code uses old BodyMovers because it predates AlignOrientation and VectorForce.

NOTICE: This is code extracted from a live game, being offered AS IS as an educational resource. I never intended this for distribution as an open-source library. You are free to try to use it in a game, but I cannot provide support or assistance in modding or incorporating it. This is why I’m not tagging it as Open Source, it’s source code I’m providing for educational value, it’s definitely not a drop-in system. There are a lot of quick-and-dirty hack fixes in this code that were required to keep it working through nearly 3 years of weekly Roblox udpates!

Features:

You can walk oriented to surface normals, with smooth transitions between adjacent surfaces:


Supports part Velocity and RotVelocity so that your character sticks to moving surfaces:

Supports smooth terrain:

Allows walking around edges, with physics interaction:

Ride Moving Parts:

Controller supports Desktop keyboard and mouse, mobile, and xbox. The ClassicCamera script and controller scripts have modifications to needed to keep the camera working as expected in the reference frame of the character, so they are forked copies.

Limitations:

  • This code is fairly old (I originally wrote the GravityDrive module during a weekend in May 2017 for a space station game I never finished).
  • Does not seem to work with current version of PopperCam (so camera clips through things). I fixed this in Club RAVEN, but apparently not in this test place :-/
  • The place contains forked PlayerScripts. There are modifications and additions to several of the camera and character controller classes.
  • Jumping is supported, as are the classic /e emotes, but not the recently-added Emote system, nor animation packs.
  • Seats are not supported, because of how jumping has been re-implemented
  • Character will not move along with parts that are moved by CFraming or Motor6Ds, or any other means that does not use Velocity and RotVelocity.
  • Comments are sparse, code is not clean, lots of stuff is commented out, debug code present, etc.

Un-copy-locked place:

116 Likes

This is awesome! I think this handles a lot of things so much better than mine. It’s definitely interesting to see the similarities too!

I keep finding the stuff you do so inspiring! :clap:

Edit: I’d love to implement some of the stuff you do into mine if that’s okay?

30 Likes

Absolutely! If you need anything explained, or want to chat about it some time, just let me know. I unfortunately don’t have the kind of free time I’d need to assist developers in integrating this into games, but you’ve given so much to this community, I’d be happy to take the time to answer any questions you have, or explain any of the myriad of hacks in this place :slight_smile:

16 Likes

Awesome! I thought about make a futuristic (Something like star-wars) roleplay game with this! :+1:

3 Likes

This looks so cool! I did try to play the game though and my player wouldn’t move? Just thought I’d point that out.

3 Likes

That’s a good contribution and probably will inspire a new genra of games hopefully. Good job!

2 Likes

There’s probably a loading race condition if it doesn’t happen every time.

1 Like

Nope, doesn’t work even when I reopened it a couple times :frowning:

3 Likes

Okay I’ve been dreaming of the day I figure out how to achieve this effect, and had a sense that a game I’ve been playing has some sort of gravity effects going on for his vehicles (Base Wars by D8Dev), but oh my gosh the day is here! I’ve found your solution here, and this is GREAT!!! THANK YOU SO MUCH!!! I shall find this very educational and provide some great ideas … I’ll try applying AlignOrientation and VectorForce tech, a well.

1 Like

It’s happening the same thing to me as well, as I spawn in the game my character is just freezed.

5 Likes

My only small nitpick about it is that it lacks compatibility with other animations/character movement scripts. It can be modified, but the level of scripting used is almost alien to me. I’ll figure it out eventually. This controller is amazing though. Nice work.

1 Like

I have a question. How do you use it for only certain part’s??

2 Likes

That is a good question, even i’ve wear with morph, i couldn’t move around like it stuck in gravity. I was wondering about that.

1 Like

This is great! Thanks for your contribution! Looking forward to new games using this!

For those commenting that your player can’t move, try making a copy and running it in Studio. It does seem to run ok in studio.

Hello, I have a question. Can I somehow make this work only when part is touched and stop it when another part is touched?

2 Likes

Hi, I’m having problems with this Place on Mobile. When using the mobile thumbstick the character randomly changes direction. Steps to reproduce are as follows:

  1. Follow the OP’s link to the Gravity Tensor World sample
  2. Click the “Edit” in dropdown of Gravity Tensor World to open it in Roblox Studio
  3. Click the little “mobile” icon in top right of Roblox Studio to switch to phone simulation
  4. Press play icon in Studio to run the Place
  5. Use the mobile thumbstick to walk up the walls of the large loop
  6. Notice your character is unable to walk straight.

Observed: character randomly changes direction while walking up walls.
Expected: pushing straight up on mobile thumbstick should make character walk straight.

I’ve been digging around in all of these source files and so far I didn’t find anything specific to mobile thumbstick. So I’m not sure why this works fine on Desktop but not so well on mobile. Any help the community can provide, would be greatly appreciated!

This is a spectacular resource! However, I have been working with it for several days now, and I can’t figure out how to make it only work on terrain. This is for a planet system, so I only want players walking on terrain. I have tried to use the gravityboots remote events, but I just can’t figure it out. How does it work?

P.S Sorry for the necropost

Is there a way to make this togglable? Such as by pressing a button