How to create a hierarchical constraint?

I need this structure:

Part1 -- parent
--- Part2 -- child of Part1
------ Part3 -- child of Part2

If I rotate Part1, both Part2 and 3 must follow Part1 rotation.
But if I rotate Part2, Part1 (parent) can’t be rotated.

For that, I created 2 WeldConstraint: one connecting Part2 to Part1 and the other connecting Part3 to Part2:

Finally, I have this script to rotate only Part2 (which will automatically rotate Part3):

while true do
	workspace.Part2.CFrame = workspace.Part2.CFrame * CFrame.Angles(math.rad(10), 0, 0)
	wait(0.1)
end

However, Part1 is also being rotated.

r

Here the test project: Baseplate.rbxl (21.6 KB)

How to rotate Part2 and 3 but avoid rotating Part1?

1 Like

Part 1 is also being rotated because you weld constrainted part 1 to part 2 as shown in the pic.

Well, how to solve this? How to create a hierarchical constraint?

According to the DevHub changing the Orientation of Part2 instead of the CFrame should solve your issue because when you change Part2’s CFrame, Part1’s CFrame also gets updated unlike when using the Position and Orientation properties.

But this was just a simplified example.
Think about a car with wheels. If I move the car, the wheels must follow the car. But if I spin a wheel (child), it will not rotate the car (Parent)… However, the rotation of the wheel must rotate their children, such as tires, screws, hubcaps, etc.
I can’t do a calculation of absolute displacement and rotation on a fixed screw, which is attached to a rotating wheel, which is attached to an axle, which is attached to a car that moves and turns, you know?

Incredibly, no one was able to answer.
But I found an alternative solution: temporarily setting Part2.WeldConstraint.Part0 to nil, which will force Part2 to disconnect from its parent.
Then, the CFrame rotation of Part2 will work, rotating only its children.
Finally, reconnect Part2.WeldConstraint.Part0 to Part1.

1 Like

They’re useless, that’s why no one was able to help