You are browsing as a guest. Sign up (or log in) to start making projects!

1h 12m 17s logged

A Physics Based Car Controller in Unity! (Tire friction simulated !!)

Devlog #2: Adding Friction to them Tires 🔥🔥

So this was a tough one. On the surface the theory is pretty simple, friciton force acts opposite to the direction of motion and its magnitude is friction coeffecient*Normal force on one tire.

that I implemented by calling each tires velocity , and taking its dot product with each tire’s RIGHT vector, so if the result is 1 –> rightways velocity, if its -1 –>leftways velocity and if its 0 then the car is moving straight.

I wrote the code for this and steering which just rotates the front two tires by a set amount. Felt pretty good and pressed play, and BOOM the car is spinning, the tires are spinning, MY HEAD WAS SPINNING.

The majiority of todays time was spent figuring out what was going wrong 😭 , Went through the Unity Docs, reddit and everything couldn’t find the bug.

I set the steering function to rotate the front tires in world space and not local space

welp that was the problem, Just One word!! Makes me think how important part even a small thing plays in a big system and That is my argument against nihillism lol!

Learned how to normalize vectors today and successfully debugged my code. Yup See ya’ll in the Next one!

0
3

Comments 0

No comments yet. Be the first!