Lua: GetUnitRotation (to go along with SetUnitRotation)

Lua: GetUnitRotation (to go along with SetUnitRotation)

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Lua: GetUnitRotation (to go along with SetUnitRotation)

Post by knorke »

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

Code: Select all

local rx,ry,rz=Spring.GetUnitDirection (unitID)
Spring.SetUnitRotation (unitID, rx, ry, rz)
With such function it would be easier to write things like

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
Add the moment you would have to convert from directions to rotations.
Post Reply

Return to “Feature Requests”