Make CFraming work with WeldConstraints

As a Roblox developer, it is currently too hard to hard to CFrame WeldConstrainted parts. When you CFrame a part that’s connected to other parts with WeldConstraints, everything goes with it, so you have to disable those WeldConstraints and enable them back after. Well, the issue with that is with lag or lots of movement, it’ll get shifted over from where it was originally.

If Roblox is able to address this issue, it would improve my development experience because I wouldn’t have to go through all of the trouble of switching to Position and Orientation, which doesn’t have that behavior I believe.

1 Like

Could you elaborate on your use case? Why do you need to CFrame a part in this way?

1 Like

I have a door and a trapdoor in my game, and I use CFrame because it works even if it’s rotated.

If your concern is CFrame moving parts that are welded, then you can use Position and Orientation instead:

-->> this moves the entire assembly
local cf = CFrame.new()
Part.CFrame = cf
1 Like

CFraming Parts in Studio or in game?
In Studio why not just use the Move tool? Or change the Position and Orientation in the Part Properties?
In game moving Anchored Parts with CFraming is how Tweening works. If the trap door doesn’t move around (like an Anchored structure) then move it with a Tween.
If you are moving a trap door on a vehicle that isn’t Anchored then just use a HingeConstraint for the door.

Is that not intentional?


I avoid using WeldConstraint because of weird quirks like this one. I always use Weld instead so I can edit the C0 and C1 properties.

So, just use Weld. It’s a rigid joint, but the only issue is editing them. Motor6D has added functionality to be able to drag it around in studio without it breaking, so you might be able to use that type of weld.

Part.Orientation = cf.Rotation doesn’t work.

My bad, I thought CFrame.Rotation returned the CFrame’s orientation as a Vector3.

To get the orientation, you can do:

local cf = CFrame.new()
local x, y, z = CFrame:ToEulerAnglesXYZ()
Part.Orientation = Vector3.new(
    math.deg(x),
    math.deg(y),
    math.deg(z)
)

On a side note, CFrame’s behavior on welded assemblies is to move the assembly with it. The method of transforming a welded part in an assembly is the method that should be used when you don’t want the entire assembly to move with it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.