stopping cars from sliding on walls

Greetings everyone

we are making a racing game like mario kart and we have faced a problem that we couldn’t fix, the cars can lean on the wall and just drive forward with full speed in an unrealistic fashion and it looks bad so we need someone to help us fix the issue

we managed to make it slow down or turn its face forward at some cases using raycast but the issue still there(and raycast isnt always accurate sometimes it reacts to walls from a distance).

we are using capsule collider and couldnt can’t fix this issue without changing our capsule collider because all our driving controls are built around it.

  • people suggested that we use physics material but the programmer said
    (“that doesn’t work with our car physics + capsule collider. the only part of unity physics that it uses is the actual movement and collision because making something collide otherwise is a massive hassle”)

we need a perfect solution for this please, something that wouldn’t break the gameplay, looks good, and not performance heavy on mobile devices

video of the issue:
https://streamable.com/9i7gkc

@AMDonline, it is not possible to tell with the little information you have given what a solution might be. We need to know a lot more, and we’d need to see the code. If you have a programmer telling you what is and is not possible based on suggestions from people who have not inspected the code, I don’t think you’d get anywhere.

For a start, are these user controlled cars that are getting stuck on the curb or what? If you have a programmer surely they can figure out a way of coming out of that.

What mechanism is used to detect whether or not a car is on the road?

Unity handles collisions without any hassle at all if the objects are non-kinematic, which they must be if the code uses physics to power them, so again, without seeing the code, I don’t know where your programmer is coming from.

Not sure why you don’t just allow free movement at a cost - if the code uses some mechanism to detect if the car is on the road, then just make it cost a lot more to move if it is not by adding drag, or other methods.

Again, all you will get are shots in the dark!

I’m curious at why you tagged me for this question, I would like to know haha.

But I concur with streetwalker, without code or an explanation of why the collider affects so much the handling of the car (which it shouldn’t), its very hard to know what is causing the problem.

From the video I would dare to say that there is an invisible wall collider which is too thin and is causing that both colliders get stuck between them, which sometimes happens in Unity. If two objects collide with each other with a considerable speed and a collider is small, they get stuck since the physics calculation can’t keep up with the speed.

@Orloffyeah @streeetwalker