In my games, the user can rotate objects only in 90-degree steps.
I use Tween to rotate the objects.
Tween almost always returns non-round values, due to the inaccuracy of float operations.
Therefore, a 90-degree rotation on the Y axis should return a clean Cframe like:
There’s not much you can do about floating point rounding errors, because it’s handled internally.
However, in Lua, integers can be represented in doubles accurately up to 2^53, so why not store the value(s) as an integer?
local cframeTable = table.pack(cframeValueHere:GetComponents())
for i, v in pairs(cframeTable) do
cframeTable[i] = math.round(v)
end
local roundedCFrame = CFrame.new(table.unpack(cframeTable))
Hello, is there a way to prevent this script from rounding one of the values of a Cframe? Example, if it is coordinates, do not round the Y but round the others. Thanks!