Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function recurse(root,callback)
- for i,v in pairs(root:GetChildren()) do
- callback(i,v)
- if #v:GetChildren() > 0 then
- recurse(v,callback)
- end
- end
- end
- _G.recurse = recurse
- local aggressiveness = 4
- local lowerLimit = {
- [0] = 0.06;
- [1] = 0.1;
- [2] = 0.2;
- [3] = 0.3;
- [4] = 0.4;
- }
- local upperLimit = {
- [0] = 0.994;
- [1] = 0.9;
- [2] = 0.8;
- [3] = 0.7;
- [4] = 0.6;
- }
- function round(n, aggressiveness)
- local sign = n < 0 and -1 or 1
- n = math.abs(n)
- if n - math.floor(n) <= lowerLimit[aggressiveness] then
- --print("small",angle)
- return math.floor(n) * sign
- elseif n - math.floor(n) >= upperLimit[aggressiveness] then
- --print("small missing",angle)
- return (math.floor(n)+1) * sign
- end
- return n * sign
- end
- function _G.fixRotation(part)
- local originalCFrame = part.CFrame
- local rotation = part.Rotation
- local size = part.Size
- local newRotation = Vector3.new(round(rotation.X, aggressiveness), round(rotation.Y, aggressiveness), round(rotation.Z, aggressiveness))
- --print("Rotations", rotation,"::",newRotation)
- part.Rotation = newRotation
- if not part:IsA("PartOperation") then
- part.Size = Vector3.new(round(size.X, 0), round(size.Y, 0), round(size.Z,0))
- end
- part.CFrame = part.CFrame - part.CFrame.p + originalCFrame.p
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement