Another bite-sized tutorial! So I’ll just shut up and get on with it.
Do you want to blend two different animations when both affect one body part?
Something like a running animation like this;
With a weapon hold animation like so?
But then you try playing them together and get this… ew… Yucky.
Well that was me around a week ago but then suddenly my mind started cranking 90s and I got this:
A beautiful mixture of the two animations like they SHOULD be!
So how did I do this?
It’s easy!
First of all, you need to import your animation from the tool box.
After that you need to run a very basic script from the command bar:
local keyFrames = Instance.new("Folder",workspace)
local bodyPart = "Torso"
for _,keyframe in workspace.KeyframeSequence:GetChildren() do
local Value = Instance.new("CFrameValue")
Value.Name = math.round(1/keyframe.Time)
Value.Value = keyframe:FindFirstChild(bodyPart,true).CFrame
Value.Parent = keyFrames
end
workspace.KeyFrameSequence:Destroy()
keyFrames.Parent = workspace
Where the bodyPart
variable is your body part which you want to blend.
Afterwards you get a folder, name it whatever you want and parent it to your script.
After that you get this very simple script:
local m6d = script.Parent.HumanoidRootPart.RootJoint
local offset = m6d.C0
local frame = 0
local a1:AnimationTrack = script.Parent.Humanoid.Animator:LoadAnimation(script.Anim) -- First base animation.
a1:Play(0,1,1)
local a2:AnimationTrack = script.Parent.Humanoid.Animator:LoadAnimation(script.Anim2) -- Second overlapping animation.
a2.Priority = Enum.AnimationPriority.Action4
a2:Play(0,1,1)
game:GetService("RunService").Heartbeat:Connect(function(deltaTime)
frame = frame%#script.Walk:GetChildren() + 1
local val = script.Walk:FindFirstChild(frame) -- The first base animation
m6d.C0 = val.Value:Inverse() * offset
end)
It’s a bit rough but conveys the concept pretty well! The concept being, you use motor 6ds to play the animation manually.
That’s all. Thanks.
- Great tutorial! Useful!
- Bad tutorial, useless.
0 voters
Should I make this into something like a series of just bite-sized random tutorials on random issues?
- Yes
- No
0 voters