querySphere.lua 1.4 KB

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