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.
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.
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!
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.
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)