How to use CFrame with Weld Constraint? I need to change the position of the red cube using CFrame, but the position of the entire model changes
The devhub article says that parts will update if you change the connected part’s CFrame, but not with position changes. Either use the position property or temporarily disable the constraint before moving.
workspace.Test.RedPart.CFrame = workspace.Test.RedPart.CFrame + Vector3.new(0,10,0)
Correct, or somehow change?
I need the constraint to work at the time of moving.
This is a bit more complicated. What I don’t understand is whether you even need a weld constraint here. Manually CFraming them would be much easier if those parts can be left anchored.
If they can be left anchored, this code is good enough:
local posRed0 = partBlue.Position
local posRed1 = posRed0 + Vector3.new()
local posBlue0 = partBlue.Position
partRed.CFrame = CFrame.lookAt(posRed1, posBlue0)
partBlue.CFrame = CFrame.lookAt(posBlue0, posRed1)
Details not anchored. I need the gray part to be able to lie on the floor, but when the red cube gets close to the ground, it is pushed up.
In that case you’ll need to use the AlignOrientation constraint. I’m not very knowledgable with those, so I can’t help you much.