Im making npcs client visuals, and from a HumanoidRootPart, making the rest of the humanoid body with welded part using a simple weld, and I wanted to animate the arms and legs, like a minecraft character, rotating the arms and legs from the top as pivot, but cant do it without attachments. I tried using C0 for the angle and C1 for the offset, but seem to not work, someone can help?
I have never worked with animating welded parts, so I’m not sure if this will work, but you can try:
local function animateLimb(limb, rotation)
-- Assuming limb is the part you want to animate
local weldConstraint = limb:FindFirstChildOfClass("WeldConstraint")
if weldConstraint then
local jointOrientation = CFrame.Angles(0, rotation, 0) -- Adjust rotation as needed
weldConstraint.C0 = jointOrientation
end
end
-- Add more to reference more parts of the rig
local arm = --[[ Reference to the arm part ]]
local leg = --[[ Reference to the leg part ]]
-- Animate the arms and legs by rotating them around the top as pivot
animateLimb(arm, math.rad(45)) -- Rotate arm by 45 degrees
animateLimb(leg, math.rad(-30)) -- Rotate leg by -30 degrees
Thank you for helping, I finally nail it, You put the offset from the torso and the arm/leg in the C0, add the rotation in C0 too, and finally add the lenght of the arm/leg divide in two, example: torso is 4,4,4 in size and the arm 2,2,8 you make the weld C0 position (4/2 + 2/2, 4/2,0) and the C1 will be (0,0,-8/2)