target.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. return {
  2. summary = 'Create a model transform that targets from a position to target position.',
  3. description = [[
  4. Sets a model transform matrix that moves to `from` and orients model towards `to` point.
  5. This is used when rendered model should always point towards a point of interest. The
  6. resulting Mat4 object can be used as model pose.
  7. The target() function produces same result as lookAt() after matrix inversion.
  8. ]],
  9. arguments = {
  10. from = {
  11. type = 'Vec3',
  12. description = 'The position of the viewer.'
  13. },
  14. to = {
  15. type = 'Vec3',
  16. description = 'The position of the target.'
  17. },
  18. up = {
  19. type = 'Vec3',
  20. default = 'Vec3(0, 1, 0)',
  21. description = 'The up vector of the viewer.'
  22. }
  23. },
  24. returns = {
  25. self = {
  26. type = 'Mat4',
  27. description = 'The modified matrix.'
  28. }
  29. },
  30. variants = {
  31. {
  32. arguments = { 'from', 'to', 'up' },
  33. returns = { 'self' }
  34. }
  35. },
  36. related = {
  37. 'Mat4:lookAt',
  38. 'Quat:direction'
  39. }
  40. }