queryBox.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. return {
  2. tag = 'worldBasics',
  3. summary = 'Find all shapes that intersect a box.',
  4. description = 'Finds all the shapes that intersect a box and calls a function for each one.',
  5. arguments = {
  6. x = {
  7. type = 'number',
  8. description = 'The x coordinate of the center of the box.',
  9. },
  10. y = {
  11. type = 'number',
  12. description = 'The y coordinate of the center of the box.',
  13. },
  14. z = {
  15. type = 'number',
  16. description = 'The z coordinate of the center of the box.',
  17. },
  18. w = {
  19. type = 'number',
  20. description = 'The width of the box.',
  21. },
  22. h = {
  23. type = 'number',
  24. description = 'The height of the box.',
  25. },
  26. d = {
  27. type = 'number',
  28. description = 'The depth of the box.',
  29. },
  30. position = {
  31. type = 'Vec3',
  32. description = 'The position of the center of the box.'
  33. },
  34. size = {
  35. type = 'Vec3',
  36. description = 'The size of the box.'
  37. },
  38. callback = {
  39. type = 'function',
  40. default = 'nil',
  41. description = [[
  42. An optional function to call when an intersection is detected. The function will be called
  43. with a single `Shape` argument, and it may return `false` to cancel the query.
  44. ]]
  45. }
  46. },
  47. returns = {
  48. any = {
  49. type = 'boolean',
  50. description = 'Whether there were any intersections.'
  51. }
  52. },
  53. variants = {
  54. {
  55. arguments = { 'x', 'y', 'z', 'w', 'h', 'd', 'callback' },
  56. returns = { 'any' }
  57. },
  58. {
  59. arguments = { 'position', 'size', 'callback' },
  60. returns = { 'any' }
  61. }
  62. },
  63. notes = 'Currently there is no way to specify a rotated box.',
  64. related = {
  65. 'World:querySphere',
  66. 'World:raycast',
  67. 'World:getContacts',
  68. 'Shape:setSensor'
  69. }
  70. }