Psilocervine's Open World Jamstravaganza - Making Your Way in the World Today Takes a Robust Character Controller

Despite my lack of updates, only some of my lack of progress is because of Elden Ring. I can't help it. The game lets me marry a living doll. I have a type.

That said, I'm 100% going to miss the deadline but I don't care because I've been enjoying working on this game. My most recent efforts have been focusing on making a vehicle controller for the hoverbike thing the protagonist is going to be jetting around on and lemme tell ya, it has been an ordeal.[i] My first attempts basically just involved using invisible wheel colliders and having those provide all the functionality I needed, but it turns out that Unity's wheel colliders are kinda... awful for that? Figuring out what their specific dampening values and everything need to be is also an arduous process because they're all expecting ranges I'm expected to just guess I suppose.

My next solution was to use raycasts and physics forces. Figuring that the best way to ensure the bike from flipping would be to have some spread out forces, I put four of them around the bike and lowered the center of mass so that it was always inclined to stay upright. This [i]kinda worked, but it meant that applying forces at positions for steering had to have special offsets, and that resulted in weird torque behaviours that were a nightmare to diagnose and even more of a nightmare to code.

Not fun.

Then, one night, as I was tossing and turning in bed, I awoke in a start. Not because of inspiration, but because I'm prone to nightmares. To work myself down from the post-nightmare anxiety, I started thinking of new ways to get this to work, and I finally settled on a hybrid solution of an idea I had the night before and a new one as well.

Instead of using four raycasts, I use two, front and back. Next, I lock the bike's rotation along the z-axis and only ever change that with direct access from code to make the steering look "cool" by giving it a bit of a banking effect. Then, on top of all this, I added some dampening physics to it all. The front raycast gets a low dampening value to make it extra bouncy, and the rear raycast gets a high one to make it more rigid. In a way, it sorta recreates the suspension of a motorcycle! Neat!

After that, I added some extra quality of life stuff. Instead of immediately losing forward thrust in the air, I made it so that if you spend too much time in the air (about half a second), you start to have the amount of thrust the accelerator gives you drop to half its strength, meaning you can't fly around forever. I also added some functionality to make the bike automatically balance to face the horizon after a second or so in the air to help keep the player from flipping around all over the place. In the end, after far too many lines of code (both included, commented out, and deleted) I finally have something I think I really enjoy zipping around on, which is all I could really ever ask for!

Motion sickness warning on this video, by the way. I'm still mucking about with the camera system.
https://www.youtube.com/watch?v=IIZVrT5BFNA

I just think it's neat!