diff --git a/cpml/mat4.lua b/cpml/mat4.lua index cb4d6a4..605bd90 100644 --- a/cpml/mat4.lua +++ b/cpml/mat4.lua @@ -364,7 +364,8 @@ function mat4:look_at(eye, center, up) -- Fix 1u offset local new_eye = eye + forward - return mat4():identity():translate(-new_eye.x, -new_eye.y, -new_eye.z) * view + local out = mat4():translate(-new_eye.x, -new_eye.y, -new_eye.z) * view + return out * self end diff --git a/cpml/vec3.lua b/cpml/vec3.lua index 89d89f0..be9c28d 100644 --- a/cpml/vec3.lua +++ b/cpml/vec3.lua @@ -223,9 +223,9 @@ end function vector:orientation_to_direction() return new(0, 1, 0) - :rotated(self.x, new(1, 0, 0)) - :rotated(self.y, new(0, 1, 0)) :rotated(self.z, new(0, 0, 1)) + :rotated(self.y, new(0, 1, 0)) + :rotated(self.x, new(1, 0, 0)) end -- the module