Type Boolean Object InputDevice Revision 2019.3459 Keywords device, input, vibrate, canVibrate See also object:vibrate()
Determines if the input device supports vibration/rumble feedback. This is a features that usually gamepads support.
true if vibration is supported. This means that you can call the input device's vibrate() function.
false if vibration feedback is not supported by the input device or if it is not supported by the operating system.
-- Called when a key event has been received local function onKeyEvent( event ) -- Vibrate the gamepad if its 'A' button was pressed if ( event.keyName == "buttonA" ) and ( event.phase == "down" ) then if event.device and event.device.canVibrate then event.device:vibrate() end end end -- Set up the above function to receive key events Runtime:addEventListener( "key", onKeyEvent )