The game I’m currently working on randomly assigns character sizes per each run. The only problem is that I’m using skinned meshes (with bones and motor6ds) and animations need to be rescaled for rigs of different sizes. Since there are hundreds of possible sizes, it’s currently not effective for me to upload an animation for every single size possibility. As a result, I’ve forked OKevinO’s plugin for scaling animations with skinned meshes to use on the KeyFrameSequences during runtime, only to discover that running KeyFrameSequences is only possible on Studio and not in game.
Current code:
function Scaling:ScaleAnimation(Animations, Original, New)
local Folder = Instance.new('Folder')
local ScaleFactor = CalculateScale(Original, New)
if not ScaleFactor then
warn('Scale factor not present.')
return
elseif ScaleFactor <= 0 then
warn('Scale factor too low.')
return
end
for _, Animation in pairs(Animations) do
if not Animation.ClassName == 'KeyframeSequence' then
warn('Keyframe sequence not attributed.')
continue
end
local NewAnimation = Animation:Clone()
for _, Pose in pairs(NewAnimation:GetDescendants()) do
if Pose:IsA('Pose') then
Pose.CFrame = Pose.CFrame + Pose.CFrame.p * (ScaleFactor - 1)
NewAnimation.Parent = Folder
end
end
end
return Folder
end
Are there any other approaches I can take?