Lua: GetUnitRotation (to go along with SetUnitRotation)
Posted: 07 Dec 2011, 07:05
I would be nice to have a
x,y,z = GetUnitRotation (unitID)
There is
GetUnitDirection (unitID)
but it is not "compatible" with SetUnitRotation.
As can be seen when doing something like
With such function it would be easier to write things like
Add the moment you would have to convert from directions to rotations.
x,y,z = GetUnitRotation (unitID)
There is
GetUnitDirection (unitID)
but it is not "compatible" with SetUnitRotation.
As can be seen when doing something like
Code: Select all
local rx,ry,rz=Spring.GetUnitDirection (unitID)
Spring.SetUnitRotation (unitID, rx, ry, rz)
Code: Select all
while (true) do
local rx,ry,rz=Spring.GetUnitRotation (unitID)
rz=rz+0.1 --rotate unit around z-axis
Spring.SetUnitRotation (unitID, rx, ry, rz)
end