getContacts.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. return {
  2. tag = 'worldCollision',
  3. summary = 'Get a list of points where a pair of shapes touch.',
  4. description = [[
  5. Computes collision information between two shapes and returns a list of contacts where the
  6. shapes intersect. Each contact point consists of a position, a normal vector, and a penetration
  7. depth.
  8. ]],
  9. arguments = {
  10. shapeA = {
  11. type = 'Shape',
  12. description = 'The first shape.'
  13. },
  14. shapeB = {
  15. type = 'Shape',
  16. description = 'The second shape.'
  17. }
  18. },
  19. returns = {
  20. contacts = {
  21. type = 'table',
  22. description = [[
  23. A list of contacts. Each contact consists of 7 numbers: the contact position, the normal
  24. vector, and a depth value indicating how far the shapes intersect each other at the contact
  25. point (`{ x, y, z, nx, ny, nz, depth }`).
  26. ]]
  27. }
  28. },
  29. variants = {
  30. {
  31. arguments = { 'shapeA', 'shapeB' },
  32. returns = { 'contacts' }
  33. }
  34. },
  35. notes = [[
  36. This only detects collision information, it does not cause the shapes to collide with each
  37. other. Use `World:collide` for that.
  38. This function ignores collision tags.
  39. ]],
  40. related = {
  41. 'World:collide'
  42. }
  43. }