From e9935b18a5599ce08c1f01195dcc282f01241fc3 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Mon, 27 Oct 2014 09:53:57 -0700 Subject: [PATCH] Fix orientation_to_direction, mult look_at on self --- cpml/mat4.lua | 3 ++- cpml/vec3.lua | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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