[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:

53 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?

13 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:

8 Likes

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

1 Like

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.

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

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

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

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.

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

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

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

1 Like

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.