target.lua 983 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 torwards 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. {
  11. name = 'from',
  12. type = 'Vec3',
  13. description = 'The position of the viewer.'
  14. },
  15. {
  16. name = 'to',
  17. type = 'Vec3',
  18. description = 'The position of the target.'
  19. },
  20. {
  21. name = 'up',
  22. type = 'Vec3',
  23. default = 'Vec3(0, 1, 0)',
  24. description = 'The up vector of the viewer.'
  25. }
  26. },
  27. returns = {
  28. {
  29. name = 'm',
  30. type = 'Mat4',
  31. description = 'The original matrix.'
  32. }
  33. },
  34. related = {
  35. 'Mat4:lookAt',
  36. 'Quat:direction'
  37. }
  38. }