function Meta.SetOrientationYZ(S,E,R)S.topVector=E.unit S.rightVector=(S.topVector:Cross(R)).unit S.backVector=S.rightVector:Cross(S.topVector)end function Meta.VectorToObjectSpace(R,E)return E:Dot(R.rightVector),E:Dot(R.topVector),E:Dot(R.backVector)end function Meta.VectorToWorldSpace(R,E)return(E.x*R.rightVector+E.y*R.topVector)+E.z*R.backVector end function Meta.new()local E=setmetatable({},Meta)return E end return Meta
--Set the orientation with Y taking precedence, then Z.
function Meta:SetOrientationYZ(upVector, backVector)
	self.topVector = upVector.unit
	self.rightVector = self.topVector:Cross(backVector).unit
	self.backVector = self.rightVector:Cross(self.topVector)
end

function Meta:VectorToObjectSpace(v)
	return v:Dot(self.rightVector), v:Dot(self.topVector), v:Dot(self.backVector)
end
function Meta:VectorToWorldSpace(v)
	return v.x * self.rightVector + v.y * self.topVector + v.z * self.backVector
end

function Meta.new()
	local self = setmetatable({}, Meta)
	return self
end

return Meta
