Hello everyone, so I recently finished ‘Jespone’s guide to animations’ Tutorial, and let me tell you I learned A LOT from it, but I still felt like I needed more information. What that little more information was for animating with models and parts.
The vent animation is exactly the little more information that I was searching for, it just looks so sick!!
How can I make animations with models and parts like a sword or a tool pick up animation?
You usually rig external objects by making a “path” of Motor6Ds from the humanoid to this object
For example:
HumanoidRootPart → LowerTorso → UpperTorso → LeftUpperArm → LeftLowerArm → LeftHand
In this case I would guess that they did something like:
HumanoidRootPart → VentBase → MovingPartOfVent
In game you would have to firstly create the Motor6Ds between HumanoidRootPart and VentBase, and setting the origin offsets to the correct thing then the Motor6D between VentBase and MovingPartOfVent.
In game you would just have to “rerig” the model in a script, which just involves creating the Motor6Ds, setting their Part0 and Part1 properties, and for the smoothest experience set the offsets to the proper offset
How would I do that? Like destroying it and then cloning it back to the player and after the player has gone through the vent, I delete the vent parented to the player and cloning back to the workspace?
local ClickDetector = game.Workspace.Map.Vent.VentBase.ClickDetector
local VentBase = Instance.new("Motor6D")
local VentPart = Instance.new("Motor6D")
local Vent = game.ReplicatedStorage.Vent
ClickDetector.MouseClick:Connect(function(player)
local chr = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local target = game.Workspace.Map.Vent.PrimaryPart
function lookAt(chr,target) --assume chr is a character and target is a brick to look towards
if chr.PrimaryPart then --just make sure the character's HRP has loaded
local chrPos=chr.PrimaryPart.Position --get the position of the HRP
local tPos=target.Position --get the position of the target
local newCF=CFrame.new(chrPos,tPos) --create our CFrame
chr:SetPrimaryPartCFrame(newCF) --set the HRP's CFrame to our result, thus moving the character!
end
end
player.Character:moveTo(Vector3.new(-42, 3, -27.61 ),lookAt(chr, target))
lookAt(chr, target)
game:GetService("ContextActionService"):BindActionAtPriority(
"t",
function()
return Enum.ContextActionResult.Sink
end,
false,
Enum.ContextActionPriority.High.Value + 1,
unpack(Enum.PlayerActions:GetEnumItems())
)
local newVent = Vent:Clone()
newVent.Parent = player.Character
VentBase.Name = "VentBase"
VentBase.Part0 = chr.HumanoidRootPart
VentBase.Part1 = chr.Vent.VentBase
VentBase.Parent = chr.HumanoidRootPart
VentPart.Name = "VentPart"
VentPart.Part0 = chr.Vent.VentBase
VentPart.Part1 = chr.Vent.VentPart
VentPart.Parent = chr.Vent.VentBase
--game.ReplicatedStorage.RemoteEvent:FireServer(player)
end)
game.ReplicatedStorage.RemoteEvent2.OnClientEvent:Connect(function(isnotMoving)
if isnotMoving == false then
game:GetService("ContextActionService"):UnbindAction("t")
end
end)