getAxis.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. return {
  2. tag = 'input',
  3. summary = 'Get the state of an analog axis on a device.',
  4. description = [[
  5. Get the current state of an analog axis on a device. Some axes are multidimensional, for
  6. example a 2D touchpad or thumbstick with x/y axes. For multidimensional axes, this function
  7. will return multiple values, one number for each axis. In these cases, it can be useful to use
  8. the `select` function built in to Lua to select a particular axis component.
  9. ]],
  10. arguments = {
  11. device = {
  12. type = 'Device',
  13. description = 'The device.'
  14. },
  15. axis = {
  16. type = 'DeviceAxis',
  17. description = 'The axis.'
  18. }
  19. },
  20. returns = {
  21. ['...'] = {
  22. type = 'number',
  23. description = [[
  24. The current state of the components of the axis, or `nil` if the device does not have any
  25. information about the axis.
  26. ]]
  27. }
  28. },
  29. variants = {
  30. {
  31. arguments = { 'device', 'axis' },
  32. returns = { '...' }
  33. }
  34. },
  35. notes = [[
  36. The axis values will be between 0 and 1 for 1D axes, and between -1 and 1 for each component of
  37. a multidimensional axis.
  38. When hand tracking is active, pinch strength will be mapped to the `trigger` axis.
  39. ]],
  40. related = {
  41. 'DeviceAxis',
  42. 'lovr.headset.isDown'
  43. }
  44. }