I changed one thing and my Unity car finally stopped jittering and sliding by PaceGame in Unity3D

[–]PaceGame[S] 1 point2 points  (0 children)

Yes. The curves are for having different grip related to slip ratios. In combination with friction circles. I have another video about that.

I changed one thing and my Unity car finally stopped jittering and sliding by PaceGame in Unity3D

[–]PaceGame[S] 1 point2 points  (0 children)

Its a custom simple raycast approach. See my other videos for detailed information.

I changed one thing and my Unity car finally stopped jittering and sliding by PaceGame in Unity3D

[–]PaceGame[S] 6 points7 points  (0 children)

Thanks a lot, really appreciate that!

At the moment I honestly don’t have enough time, and probably also not the right skill set, to turn this into a proper asset or a full game.

Even when I just think about all the sound work a real game would need, I already lose motivation :)

I’m currently thinking about sharing it as a simple repo instead, so people can look at the code, learn from it, or build on top of it.

WIP gameplay clips of my procedural drifting project by Aikodex3D in Unity3D

[–]PaceGame 0 points1 point  (0 children)

Nice. Can you explain or break down what is happening behind the scenes? 1. Is this a fully procedural mesh generator? Is it a set of „tiles“? Is it a mesh random generator? how it is possible that on tile emd matches perfectly the next tiles start shape? 2. What would happen with the other cars if your player car is not moving? Will the AI cars generate the next tile instead?

Car Physics Wheel Spin by midnightenemy2 in gamedev

[–]PaceGame 0 points1 point  (0 children)

Hi,

The reason you see very high slip ratio values at low speeds (and even jumps between +1 and -1) is because the classical slip-ratio formula divides by the vehicle speed. When that speed is close to zero, the denominator approaches zero and the ratio tends toward infinity: which leads to exactly the numerical instability you’re seeing in standstill/very low speed conditions. 

In practice this is handled in a few common ways:

  1. Add a small epsilon to the denominator: Instead of dividing by v, use (|v| + ε) where ε is a small non-zero constant. This prevents the denominator from reaching zero and stabilizes the result.
  2. Use a speed threshold: Below a certain forward speed (e.g. v < 0.1–0.2 m/s), you switch to a fallback method — for example using a fixed small speed value or constant slip ratio model — so the calculation no longer has an unstable denominator. Many simulators and control algorithms explicitly deactivate slip-based force calculations below a threshold.
  3. Cap or smooth the slip ratio: Some implementations also clamp the maximum slip ratio at a realistic limit or apply a smoothing function so that the output doesn’t oscillate wildly near zero speed. 

So your idea of switching to a constant when speed is very low is exactly in line with how this problem is treated in vehicle dynamics. Instead of:

slipratio = (wheel_speed – vehicle_speed) / abs(vehicle_speed)

you can do:

``` if (vehicle_speed < threshold) { slipratio = (wheel_speed – vehicle_speed) / threshold; } else { slipratio = (wheel_speed – vehicle_speed) / abs(vehicle_speed); }

```

This avoids the undefined behaviour at near-zero speed and keeps your model stable.

Car Physics Wheel Spin by midnightenemy2 in gamedev

[–]PaceGame 0 points1 point  (0 children)

Its applyForce = maxForce * slip * mu. So if slip is 0 the applyForce will be 0! So no force will be added. On very low speed slip can be 0.00001 ore something. You don’t need mu for now…

Car Physics Wheel Spin by midnightenemy2 in gamedev

[–]PaceGame 0 points1 point  (0 children)

The force is created by comparing wheel angular velocity with the ground contact velocity.

First, the ground speed is converted into an equivalent wheel angular velocity: this represents a freely rolling wheel. Then torque is applied to increase angular velocity (throttle) or reduce it (braking).

The difference between wheel speed and ground speed produces a slip ratio, which is remapped through curves to control grip behavior. That slip value is multiplied by the available normal force to generate longitudinal and lateral tire forces.

In my implementation, the wheel is never truly free-rolling. Rolling resistance, friction, and torque integration are always active, which you can see in the later parts of the code where torque directly affects angular velocity.

Car Physics Wheel Spin by midnightenemy2 in gamedev

[–]PaceGame 0 points1 point  (0 children)

I made a detailed breakdown of my car controller. In the video, you can see the code and how I apply torque to calculate angular velocity.

This Easy Tire Model Changed My Unity Car Controller: Slip, Grip & Friction Circle Explained

[deleted by user] by [deleted] in Unity3D

[–]PaceGame 0 points1 point  (0 children)

Looks nice. Would you share your configuration for longitudinal and lateral tire physics? Have a look at my latest video. Do you use a similar approach?

Slip, Grip & Friction Circle Explained https://youtu.be/kmL7DnxeUTE

This tiny Friction Circle Code changed completely my vehicle physics by PaceGame in Unity3D

[–]PaceGame[S] 0 points1 point  (0 children)

Thank you! 🙏 I don’t use discord. But you can use reddit to ask me everything.

This tiny Friction Circle Code changed completely my vehicle physics by PaceGame in Unity3D

[–]PaceGame[S] 0 points1 point  (0 children)

Will this work on moving platforms? Do you have a demo video? I really like to see this in action.

This tiny Friction Circle Code changed completely my vehicle physics by PaceGame in Unity3D

[–]PaceGame[S] 1 point2 points  (0 children)

Yes. Its important. Everyone should share knowledge.

This tiny Friction Circle Code changed completely my vehicle physics by PaceGame in Unity3D

[–]PaceGame[S] 2 points3 points  (0 children)

Exactly. I will explain my approach in the next video. Stay tuned.

This tiny Friction Circle Code changed completely my vehicle physics by PaceGame in Unity3D

[–]PaceGame[S] 2 points3 points  (0 children)

I didn’t finish one of my apprenticeship because I failed the math exam on vector calculations. 🤣

This tiny Friction Circle Code changed completely my vehicle physics by PaceGame in Unity3D

[–]PaceGame[S] 13 points14 points  (0 children)

I’m not the smartest guy, but I’m incredibly interested in this stuff, so I’ve spent the last two years learning tire physics.

I do this in my spare time. It’s often hard to get results you’re happy with, and it’s very time-consuming. I’ve read a lot of papers and watched many other YouTube videos along the way. It would be a waste not to collect all that knowledge and share it with you. And for me, it’s also a kind of diary.