Was just helping a user out on Discord regarding the fact that there's a hidden scale in TTS that's presently not exposed via any UI or any Lua APIs.
However, you can obtain this scale as follows:
local CARD_GUID = 'cafebf'
---@param obj tts__Object
---@return Vector
local function getObjectTransformScale(obj)
local rotation = obj.getRotation()
local onesVector = Vector(1, 1, 1):rotateOver('z', rotation.z):rotateOver('x', rotation.x):rotateOver('y', rotation.y)
local scale = obj.positionToLocal(obj.getPosition():add(onesVector))
return scale
end
function onLoad()
local obj = getObjectFromGUID(CARD_GUID)
print("Public scale:\n" .. logString(obj.getScale()))
print("Hidden scale:\n" .. logString(getObjectTransformScale(obj)))
end
This scale comes into play most prominently with cards. Basically depending on the aspect ratio of your cards you'll have a different "object transform scale". However, by default, your cards will always report getScale() as Vector(1, 1, 1).
This scale particularly comes into play when you're trying to accurately convert from known pixel coordinates on your cards to in-game coordinates, say if you're trying to place a decal in a precise location on a card face.
Honestly, I'm not even sure how to properly document this without confusing people further, but it really is important in certain situations.