I’m trying to achieve a proof of concept force feedback system for steering wheel using a modified version of “X360CE” but I’ve noticed that at times HapticService sometimes just doesn’t set the motor to any speed at all resulting in my steering wheel having no resistance or skipping a lot.
Is this a bug?
-- code snippet, everything is defined
UIS.InputChanged:Connect(function(obj)
if obj.KeyCode == Enum.KeyCode.Thumbstick1 then
local square = (obj.Position.X)^2
if obj.Position.X < 0 then square = -square end
local roundedsquare = tonumber(string.format("%.1f", tostring(math.abs(square))))
local min = math.min(0.3, roundedsquare)
if roundedsquare == oldsquare then return end
if (square <= 1 and square >= 0) then
oldsquare = roundedsquare
HapticService:SetMotor(gamepad, Enum.VibrationMotor.Small, min)
elseif (square <= 0 and square >= -1) then
oldsquare = roundedsquare
HapticService:SetMotor(gamepad, Enum.VibrationMotor.Large, min)
end
end
end)