lookAt.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. return {
  2. summary = 'Create a view transform that looks from a position to target position.',
  3. description = [[
  4. Sets a view transform matrix that moves and orients camera to look at a target point.
  5. This is useful for changing camera position and orientation. The resulting Mat4 matrix can be
  6. passed to `lovr.graphics.transform()` directly (without inverting) before rendering the scene.
  7. The lookAt() function produces same result as target() 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:target',
  38. 'Quat:direction'
  39. }
  40. }