Convert orientation vector to a direction
This commit is contained in:
parent
8056d12223
commit
651f99e7cf
@ -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})
|
||||
|
Loading…
x
Reference in New Issue
Block a user