I’ve been working on a basic vehicle suspension and controller.
I’ve managed to get the tuning just how I want it in most aspects, but I’m having an issue with the springs. I think it’s an issue with damping but I’ve played around with it quite a bit. Reducing damping makes the issue worse, increasing the damping eventually reaches a point where the springs just aren’t able to solve at all.
When turning, the springs have no issues. When driving straight, the car begins to rock.
Spring Configuration:
-- An attempt to solve this issue using dynamic damping based on steering.
RunService.Stepped:Connect(function(_, dt)
local currentAngle = math.abs(steeringMotor.CurrentAngle)
local targetDamping = normalizeRange(currentAngle, 0, 30, 800, 400)
for _, spring in pairs(Springs) do
local currentDamping = spring.Damping
local target = dampingTargets[spring]
-- Update the target
dampingTargets[spring] = targetDamping
-- Smoothly interpolate damping towards the target
spring.Damping = currentDamping + (target - currentDamping) * (dt / smoothingTime)
end
end)