Turn a car with Constraints?

Hello!

I just wanted to make a quick post and ask how you would go about making a car turn with constraints? I’m using servo hinges to turn the wheel but its super buggy (Turns fine but it spins the car out frequently) so I’m looking for a solution/substitute. Any suggestions?

1 Like

Enable limits and set both UpperAngle/LowerAngle (if you are using prismatics) to the same value. You will have to do the animation using scripts, but it is way more stable than servos, which haven’t been useful for anything for years.

You could use a basic P/D controller or an exponential decay equation to do the animation. Exponential decay looks something like this: currentAngle = (lastAngle - targetAngle) * 0.9^dt + targetAngle, where dt is the amount of seconds since the last update. This will create a nice curve that you can adjust the sharpness of by changing the value 0.9 to be closer to 1 if you want it to go slower, or further from 1 if you want it to go faster.

You can do it naively and just divide the difference by 2 (or whatever) every frame, but then it becomes frame-dependent, which isn’t a very good practice.