getDirection.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. return {
  2. tag = 'input',
  3. summary = 'Get the direction a device is pointing.',
  4. description = 'Returns the direction a device is pointing. It will always be normalized.',
  5. arguments = {
  6. device = {
  7. type = 'Device',
  8. default = [['head']],
  9. description = 'The device to get the direction of.'
  10. }
  11. },
  12. returns = {
  13. x = {
  14. type = 'number',
  15. description = 'The x component of the direction.'
  16. },
  17. y = {
  18. type = 'number',
  19. description = 'The y component of the direction.'
  20. },
  21. z = {
  22. type = 'number',
  23. description = 'The z component of the direction.'
  24. }
  25. },
  26. variants = {
  27. {
  28. arguments = { 'device' },
  29. returns = { 'x', 'y', 'z' }
  30. }
  31. },
  32. notes = [[
  33. If the device isn't tracked, all zeroes will be returned.
  34. This is the same as `quat(lovr.headset.getOrientation(device)):direction():unpack()`.
  35. ]],
  36. related = {
  37. 'lovr.headset.getPose',
  38. 'lovr.headset.getOrientation',
  39. 'lovr.headset.getVelocity',
  40. 'lovr.headset.getAngularVelocity',
  41. 'lovr.headset.isTracked',
  42. 'lovr.headset.getDriver'
  43. }
  44. }