Controller Input For Looking is Buggy

Hi,

For some reason the looking is kinda stuttery and if I hold a direction, for example, to the left it will not continue to look to the left, it will stop.

Here’s a piece of the code:

UIS.InputChanged:Connect(function(InputObject, gameProcessedEvent)
	if gameProcessedEvent then return end
	if InputObject.KeyCode == Enum.KeyCode.Thumbstick2 then
		local StickMovement = InputObject.Position
		local Delta = Vector2.new(StickMovement.x / controllerSensitivity, StickMovement.y / controllerSensitivity) * Smoothness
		local X = targetAngleX + Delta.y

		targetAngleX = math.clamp(X, -80, 80) -- look up and down
		targetAngleY = (targetAngleY - Delta.x) % 360 -- look left and right
	end
end)

Video:

check if InputChanged is still firing

If not:
when it does change, store the position of the stick in a variable
then use a heartbeat/rendersteped connection to update the camera

You’re a god send, I don’t know why I didn’t think of that, I’ve been sitting on the problem for months.

Thank you, you beautiful human being!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.