Hello, I’m trying to recreate Mario Kart 8’s kart movement in Unreal Engine 5.6.1 and when I apply force ONLY straight-forward (just pressing the W key) something weird happens:
(Watch until the end)
Basically, for some reason when applying force forward, the kart rotates a bit to the left or right and sometimes it rotates too much (like seen in the video).
I think there is a subtle change in the terrain geometry which hits one side of the cart for the sudden turn. Also there might be some barely noticeable incline that makes the car turn as it goes.
Try it on a simple flat box and do tell if it behaves better.
Use physics based vehicle solution like Chaos Vehicle or PhysX vehicle. (physX will still need considerable amount of integration)
Implement your own simplified physics vehicle movement. (works if you are making a simple game)
Before doing that though, try to minimize your contact with the ground. Make your wheels sphere colliders or something similar to avoid one wheel hitting an edge. I think this is what makes the sudden turn. Make your whole cart use one sphere collider if you can get away with it.
Also, try to introduce some friction to avoid sliding sideways down the slope. I think this makes your car slightly turn no uneven terrain. To be honest the friction part is the key here as wheels have very high “move sideways” resistance and almost none in the direction they roll.
Hey, I turned the whole kart into one collider and it works better, but the slightly rotation problem persists. Could you explain me how to do the friction thing?
Every Physics Body has properties for Linear Damping and Angular Damping. These properties are mainly used to simulate drag, and even a value of 1.0 affects the Physics Body.
For reference, in normal gravity (9.8m/s^2), a Linear Damping value of 30 is enough to stop any single body Actor from falling under the initial pull of gravity at the start of the simulation…
My advice is still to use a complete vehicle solution. Currently you are just sliding a physical I expect you will encounter numerous other issues.
i tried adjusting dampings but that affects movement and also doesnt solve the issue at all. i dont want to work with another vehicle solution because i want to keep it simple with the one i have, it works perfect, as i want, but the only issue is the landscape collision, there must be a way to work with the landscape collision to fix the issue but i cant find it.
Damping the angle while not turning can be useful. It will also make sudden movements more gradual.
You can try also Physical Materials or manually adding forces but both are workarounds. You are trying to make a “block of soap in bathtub” behave like a car and this will need some concessions.
And yes, of course it affects movement. You are trying to fix the movement after all - it will rarely be without side effects.