How do you make animations fade into other animations? And also have animations overlap others?

Fading into a different animation(Video):
I’m trying to make have an npc have a walk animation and a sit animation into a chair.

Overlapping animation:
This npc will also be able to move around their arms and legs WHILE sitting. For example, when you talk to them, the npc will move their arms around like real life hand gesturing. They might also move their head to look at you.

Is there any way to do this?

4 Likes

Hello! Not entirely sure what you mean but I’ll try to help from what I understand.

First issue:

Roblox has a fadeTime feature when playing animations, not entirely sure that’s what you meant but hope it helps!

Second Issue:

You can set the AnimationPriority to something higher for the gestures, this makes it so that the limbs can move as it has higher Priority.

Hope this helps!

7 Likes

Thank you!

For the fadeTime one, I also need the animations to be affecting the npc’s actual CFrames and everything.

Is there a way to that too?

3 Likes

You’re welcome.

I’m not sure if there’s a better method however you can use BodyPosition, though it is deprecated but I don’t think that matters. It does get a little buggy with collision at times.

Another method could be using :lerp(), haven’t tested it but I think you can lerp an anchored object.

3 Likes

I found of a Module + Plugin that turns animations into animations that can affect actual CFrame.

Is there a way to use fadeTime for this? I’m a bit confused how I would apply it.

4 Likes

From what I understand from the video, it just updates the HumanoidRootPart position which is where your player is. You could do it manually however a plugin is nice.

However for what you’re doing I’m not sure is possible, your npc has to sit in the chair from any direction but you can’t do that with an animation as you don’t know where the npc is.

Sorry if that’s hard to understand, I’m not sure how to word it better, If you want I can help you set up a BodyPosition instance!

1 Like

Hello, if you meant that it’s hard because it uses a Seat object, I’m not actually using one. I’m just making it so that it appears to be sitting through animation, instead of Humanoid.Sitting.

And yes, I would like to see the BodyPosition thing. If it won’t take too much of your time.

1 Like

I meant with the animation sit animation. And I’ll message u back when I’m done with the script!

1 Like

Oh wait I think I understand now.

The npc will be walking into the same spot always. It will not be any random direction.

2 Likes

Hello! I’m back but I have some news. The animation doesn’t work with the chair having collision. I’ll provide a video.

You can disable collision or I can try use :lerp()

Issue:

How it’s mean to look:

1 Like

Did you use Smart Animation for this?

1 Like

No, I’ll provide the script for you.

task.wait(1)

--Settings--

local SittingRig = workspace.TestRig

local Humanoid = SittingRig.Humanoid
local Animator = Humanoid.Animator

local SitAnimation = Animator:LoadAnimation(script.SitAnimation)
local SitPosition = Vector3.new(9.5, 3, 30.5)

local SitAnimationEvent = "StopAnimation"
local Chair = workspace.Chair

--MainScript--

local BodyPosition = Instance.new("BodyPosition")

BodyPosition.Position =  SitPosition
BodyPosition.MaxForce = Vector3.one * math.huge
BodyPosition.P = 500000

BodyPosition.Parent = Humanoid.RootPart

SitAnimation:Play()

SitAnimation:GetMarkerReachedSignal(SitAnimationEvent):Once(function() -- Pauses animation so it doesnt end
	SitAnimation:AdjustSpeed(0)
end)

Chair.CanCollide = false -- So it doesn't fling

Can you try using lerp please? Also, maybe we can try using collision groups if it only works with collision off.

1 Like

Sure thing, I’ll message you when its done!

1 Like

Okay thanks so much for all of your help. You are very nice!

I’ll make sure to credit you in the game.

2 Likes

Thanks for credits by the way, if you need anything else don’t hesitate to ask!

also I’ve finished, I’ll have a video for the example and the script. Keep in mind this is a example so you will have to change alot!

task.wait(1)

--Variables--

local RunService = game:GetService("RunService")

--Settings--

local Rig = workspace.TestRig

local Humanoid = Rig.Humanoid
local Animator = Humanoid.Animator

local SitAnimation = Animator:LoadAnimation(script.SitAnimation)
local SitAnimationEvent = "StopAnimation"

local Chair = workspace.Chair
local SitVector = Vector3.new(9.5, 3, 30.5)

local SitPosition = CFrame.new(Vector3.zero, Chair.CFrame.LookVector) + SitVector

--MainScript--

local IsSitting = true -- Make this false when npc is done sitting
local RunEvent

SitAnimation:Play()
Humanoid.RootPart.Anchored = true

RunEvent = RunService.Heartbeat:Connect(function()
	Humanoid.RootPart.CFrame = Humanoid.RootPart.CFrame:Lerp(SitPosition, 0.065)
	
	if not IsSitting then
		RunEvent:Disconnect() -- Prevents memory leaks
	end
end)

SitAnimation:GetMarkerReachedSignal(SitAnimationEvent):Once(function() -- Pauses animation so it doesnt end
	SitAnimation:AdjustSpeed(0)
end)
1 Like

And this still works for fade time correct?

3 Likes

Yes, where it says SitAnimation:Play() put a number in the brackets for the fade

Example: SitAnimation:Play(1)

3 Likes

Hey!

Just making sure that this helped as you never responded nor marked as solution to any replies, do you still need any assistance?