UserInputService.MouseMovement alternative that is compatible with mobile

Hi,

My camera class only works for pc because it uses Enum.UserInputType.MouseMovement. How do I make it compatible for mobile?

For example:

	self.connections:Connect(UserInputService.InputChanged, function(input: InputObject, gameProcessedEvent: boolean)
		if input.UserInputType == Enum.UserInputType.MouseMovement then
			local delta = Vector2.new(
				input.Delta.X / Settings.Sensitivity, 
				input.Delta.Y / Settings.Sensitivity)
				* Settings.Smoothness
			
			local X = targetAngleX - delta.y 
			
			targetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X 
			targetAngleY = (targetAngleY - delta.x) % 360 
		end
	end)
	

UserInputService.TouchMoved which works the same as MouseMovement

1 Like

works perfectly, thanks!!! :smiley:

1 Like

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