lookAt.lua 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. {
  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:target',
  36. 'Quat:direction'
  37. }
  38. }