diff --git a/cpml/vec3.lua b/cpml/vec3.lua index 8b936ab..89d89f0 100644 --- a/cpml/vec3.lua +++ b/cpml/vec3.lua @@ -221,6 +221,13 @@ function vector:trimmed(maxLen) return self:clone():trim_inplace(maxLen) 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)) +end + -- the module return setmetatable({new = new, isvector = isvector, zero = zero}, {__call = function(_, ...) return new(...) end})