just for the sake of experimentation, I create a gun from the factory and rotate it:
function on_input(self, action_id, action)
if action_id==hash("one") and action.released then
tx=tx+90
if tx==450 then tx=-90 end
go.set(self.gun_id, "euler", vmath.vector3(tx,ty,tz))
print(tx,ty,tz)
elseif action_id==hash("two") and action.released then
ty=ty+90
if ty==450 then ty=-90 end
go.set(self.gun_id, "euler", vmath.vector3(tx,ty,tz))
print(tx,ty,tz)
elseif action_id==hash("three") and action.released then
tz=tz+90
if tz==450 then tz=-90 end
go.set(self.gun_id, "euler", vmath.vector3(tx,ty,tz))
print(tx,ty,tz)
end
print(">>>", go.get(self.gun_id, "euler"))
end
I see from the print that
vmath.vector3(-90.010704040527, 180, -2.105209419062e-14)
turn I need, I set this euler now after creating an object, and it shows a completely different direction, and in the input printed
>>> vmath.vector3(-107.74453735352, -21.475099563599, -85.142112731934)```