Changes in GetCameraState/SetCameraState
Posted: 20 Oct 2008, 14:15
I noticed that my "go to unit" didn't work anymore. The reason is changes in GetCameraState and SetCameraState that I couldn't find in the changelog. Maybe they are listed somewhere else but I thought I just post them here anyway.
The old return value of GetCameraState was a numerically indexed table with the position and some other info.
The new return value is a table with string indices (dx, dy, dz, flipped, height, mode, name, px, py, pz, zscale).
So if you just want to go to a unit:
Hope this helps anyone..
The old return value of GetCameraState was a numerically indexed table with the position and some other info.
The new return value is a table with string indices (dx, dy, dz, flipped, height, mode, name, px, py, pz, zscale).
So if you just want to go to a unit:
Code: Select all
local currentCamState = Spring.GetCameraState()
local x, y, z = Spring.GetUnitPosition(yourUnitIDHere)
currentCamState.px = x
currentCamState.pz = z
Spring.SetCameraState(currentCamState, 1)