vibrate.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. return {
  2. tag = 'input',
  3. summary = 'Make a device go BZZZ!',
  4. description = [[
  5. Causes the device to vibrate with a custom strength, duration, and frequency, if possible.
  6. ]],
  7. arguments = {
  8. {
  9. name = 'device',
  10. type = 'Device',
  11. default = [['head']],
  12. description = 'The device to vibrate.'
  13. },
  14. {
  15. name = 'strength',
  16. type = 'number',
  17. default = '1',
  18. description = 'The strength of the vibration (amplitude), between 0 and 1.'
  19. },
  20. {
  21. name = 'duration',
  22. type = 'number',
  23. default = '.5',
  24. description = 'The duration of the vibration, in seconds.'
  25. },
  26. {
  27. name = 'frequency',
  28. type = 'number',
  29. default = '0',
  30. description = 'The frequency of the vibration, in hertz. 0 will use a default frequency.'
  31. }
  32. },
  33. returns = {
  34. {
  35. name = 'vibrated',
  36. type = 'boolean',
  37. description = 'Whether the vibration was successfully triggered by an active headset driver.'
  38. }
  39. },
  40. notes = [[
  41. When using the `openvr` headset driver on an HTC Vive, the value for the `duration` currently
  42. must be less than .004 seconds. Call this function several frames in a row for stronger or
  43. prolonged vibration patterns.
  44. On the Oculus Quest, devices can only be vibrated once per frame. Any attempts after the first
  45. will return `false`. The Oculus Go controller does not support vibration.
  46. ]]
  47. }