Hello developers!
I’m currently attempting to drive CFrames of a Character’s Parts (Head, Left Arm, Right Arm, LeftHand, RightHand, etc.) by Constraining all the part’s of a Character to another duplicate dummy’s parts using RigidConstraints.
My current issue is that by using Constraints to attach a character’s parts to the dummy’s parts, “freezes” the character, making the character unable to move. I’ve attempted using a Motor6D instead, which does move parts while also running animations, but that isn’t my goal. I’ve also attempted Constraining all parts but the HumanoidRootPart
, and that’ll just fling the player into the atmosphere (as expected).
Here is my current function that Constrains the Character’s Parts to the Dummy’s Parts
Where character
is a player’s Character, newdummy
is the Dummy Rig that goes along with the Character, part
is a descendant of the Character, and dummypart
is a descendant of the Dummy rig.
function ConstrainModel(character, newdummy)
for _, part in character:GetChildren() do
if part:IsA("BasePart") then
if newdummy:FindFirstChild(part.Name) ~= nil then
local dummypart = newdummy:FindFirstChild(part.Name)
dummypart:PivotTo(part.CFrame)
local att0 = Instance.new('Attachment')
att0.Parent = part
local att1 = Instance.new('Attachment')
att1.Parent = dummypart
local RigidConstraint = Instance.new('RigidConstraint')
RigidConstraint.Attachment0 = att0
RigidConstraint.Attachment1 = att1
RigidConstraint.Parent = dummypart
dummypart.Anchored = true
else
warn("Could not find part "..part.Name.." inside of the Dummy Avatar!")
end
end
end
end
And for extra context, the Character’s Parts are manipulated by driving the Dummy’s CFrames with the PivotTo function.