I’m attempting to vibrate the controller of my Meta Quest 2, but I am unable to with my current code found below. I have tried multiple parameter variations, but none seem to work. Despite it never working, my code always prints 1 and never returns an error or warning. Please let me know what potential solutions I can try. Thank you.
local userInput = game:GetService("UserInputService")
local haptics = game:GetService("HapticService")
userInput.InputBegan:Connect(function(input)
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightHand,1)
print("1")
end)
Variations I have tried without success:
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightHand,Enum.VibrationMotor.Large)
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightHand,Enum.VibrationMotor.Small)
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightHand,1)
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightTrigger,Enum.VibrationMotor.Large)
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightTrigger,Enum.VibrationMotor.Small)
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightTrigger,1)
Edit: I tried the following code, and both new prints returned true.
local userInput = game:GetService("UserInputService")
local haptics = game:GetService("HapticService")
userInput.InputBegan:Connect(function(input)
print(haptics:IsVibrationSupported(input.UserInputType))
print(haptics:IsMotorSupported(input.UserInputType,Enum.VibrationMotor.RightHand))
haptics:SetMotor(input.UserInputType,Enum.VibrationMotor.RightTrigger,1)
print("1")
end)