set.lua 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. return {
  2. summary = 'Set the components of the quaternion.',
  3. description = [[
  4. Sets the components of the quaternion. There are lots of different ways to specify the new
  5. components, the summary is:
  6. - Four numbers can be used to specify an angle/axis rotation, similar to other LÖVR functions.
  7. - Four numbers plus the fifth `raw` flag can be used to set the raw values of the quaternion.
  8. - An existing quaternion can be passed in to copy its values.
  9. - A single direction vector can be specified to turn its direction (relative to the default
  10. forward direction of "negative z") into a rotation.
  11. - Two direction vectors can be specified to set the quaternion equal to the rotation between the
  12. two vectors.
  13. - A matrix can be passed in to extract the rotation of the matrix into a quaternion.
  14. ]],
  15. arguments = {
  16. angle = {
  17. type = 'number',
  18. default = '0',
  19. description = 'The angle to use for the rotation, in radians.'
  20. },
  21. ax = {
  22. type = 'number',
  23. default = '0',
  24. description = 'The x component of the axis of rotation.'
  25. },
  26. ay = {
  27. type = 'number',
  28. default = '0',
  29. description = 'The y component of the axis of rotation.'
  30. },
  31. az = {
  32. type = 'number',
  33. default = '0',
  34. description = 'The z component of the axis of rotation.'
  35. },
  36. raw = {
  37. type = 'boolean',
  38. default = 'false',
  39. description = 'Whether the components should be interpreted as raw `(x, y, z, w)` components.'
  40. },
  41. v = {
  42. type = 'Vec3',
  43. description = 'A normalized direction vector.'
  44. },
  45. u = {
  46. type = 'Vec3',
  47. description = 'Another normalized direction vector.'
  48. },
  49. r = {
  50. type = 'Quat',
  51. description = 'An existing quaternion to copy the values from.'
  52. },
  53. m = {
  54. type = 'Mat4',
  55. description = 'A matrix to use the rotation from.'
  56. }
  57. },
  58. returns = {
  59. self = {
  60. type = 'Quat',
  61. description = 'The modified quaternion.'
  62. }
  63. },
  64. variants = {
  65. {
  66. arguments = { 'angle', 'ax', 'ay', 'az', 'raw' },
  67. returns = { 'self' }
  68. },
  69. {
  70. arguments = { 'r' },
  71. returns = { 'self' }
  72. },
  73. {
  74. description = 'Sets the values from a direction vector.',
  75. arguments = { 'v' },
  76. returns = { 'self' }
  77. },
  78. {
  79. description = 'Sets the values to represent the rotation between two vectors.',
  80. arguments = { 'v', 'u' },
  81. returns = { 'self' }
  82. },
  83. {
  84. arguments = { 'm' },
  85. returns = { 'self' }
  86. },
  87. {
  88. description = 'Reset the quaternion to the identity (0, 0, 0, 1).',
  89. arguments = {},
  90. returns = { 'self' }
  91. }
  92. },
  93. related = {
  94. 'Quat:unpack'
  95. }
  96. }