I'm starting a small series teaching how to make a physically simulated vehicle using raycasts and give you the start of an arcade racing game.
A raycast car is very powerful, and understanding how this works will give you a lot of control to make your vehicles behave the way you want.
My first project in Godot was a physically simulated car using a raycasts.
But back then, I lost so much time fighting with Godot's physics, due to misunderstanding how apply_forces worked that by the time I managed to fix it I was burned out and decided to start a new project. So now I'm taking a fresh look on how raycast car works, and we'll be trying to really understand all of the physics that it uses to work.

First we'll by taking a look how a raycast suspension works.
Using this, you can get a really nice looking vehicle physics very easily just setting a spring strength and damping values.
This might be the more dense information-wise video as there is so much to cover.
So I've made a lot of visualizations and debug tools to try to showcase what is happening.
We'll start simple and gradually fix and improve things.
One thing that took me a lot of time to understand is how trying to simulate a spring with raycasts can mess things up.
My first naive approach by using the spring formula had the wheel being pushed down when the spring is extended. And while some old arcade racing games use this to make the car stick to the ground, it can lead to several problems and strange happenings.

Loops using this spring pull force, for example, can lead to very strange results and make the car stick at the top even with no speed.
There are some ways to mitigate this problem, for example, you can have the spring extend less than it can compress. That gives you a bit of force when the spring extends while not having the car crash to the ground when it nears it.
While that is good to know, we'll be removing the spring pull for our final version. But I still feel its important to show how this work as I didn't find any places that explains that, and this point confused me to no end.

Then we'll be adding wheel meshes and adapt our code to understand how the wheel radius affect things.
And after we get our spring working, we just need to adjust the values to get what we want.
And while guessing values can be fun, there is actually a physics formula to get a good spring damping force based on the vehicle mass and spring strength. So I'll be showing how to use that.
Acceleration is very easy to do. And while I still haven't prepared what I'll be recording yet, we'll be looking at:
Moving the car forward by pushing the wheels
Limiting the acceleration
Rotating the wheel's meshes
Steering is done by introducing a resisting force perpendicular to the wheel.
We'll be look at:
A basic steering system that will stop our car from drifting.
A simple code to turn the wheels and control our car direction.
We can expand on this by using the Ackermann Steering Geometry. Which is a method used in real cars where one wheel rotate a little less than the other to optimize steering. This technique makes the cars behave much better at high speeds, and quite a few racing games uses this.
I'll probably do the Ackermann Steering on another video.
We can refactor our code to use dynamic drag for the wheels.
And for the acceleration.
This can be used to make the car drift more easily at high speeds.
Or we can change the drag based on terrain type.
We can also make a "handbrake" button that changes the wheel drag which will make the car dirft. Maybe we can even add skip marks.
And make some nice road tracks or different types of vehicles to test our systems.
And who know, maybe make a small arcade game with this.
I've always wanted to research how to implement a variation of flood-fill algorithm to make a car AI follow a given fixed track.

But that's it, the video for this series is nowhere near done.
I'm preparing to record the suspension part right now.
I only deeply explored how the spring works.
I still have some old code for the acceleration and steering, But I'll be reviewing them and probably change a lot still.
I'll try to release the first 3 basic videos one after another, but the more complex steering and the future extras will be probably spaced between other video tutorials.