Vehicle seat steering fluctating

I’m not sure if this is the right category, but since it’s mostly physical, I put it here.
The title is self-explanatory.
The chassis that my vehicles use rely on constraints. The suspension uses SpringConstraints + PrismaticConstraints, while the wheels and the steering use HingeConstraints. This problem either occurs randomly while driving or when I press the A or D keys rapidly. I tried changing some properties of the hinge and the physical properties of the wheels, but those didn’t seem to fix it (or maybe I’m not setting the right values).

This is the part of the driver seat script that handles the steering (in a Local script)

driver_seat:GetPropertyChangedSignal("Steer"):Connect(function()
	if driver_seat.Steer == 1 then --right
		for i,v in pairs(steer_hinges) do
			v.TargetAngle = driver_seat:GetAttribute("TurnAngle")
		end
	elseif driver_seat.Steer == 0 then --straight
		for i,v in pairs(steer_hinges) do
			v.TargetAngle = 0
		end
	elseif driver_seat.Steer == -1 then --left
		for i,v in pairs(steer_hinges) do
			v.TargetAngle = -driver_seat:GetAttribute("TurnAngle")
		end
	end
end)

Did you mean to put the “-” infront of that?

The “-” makes the number value negative.

Aside from that, maybe try adding some kind of short debounce.

1 Like