WeldConstraint
Rigidly joins two parts as they are right now: they keep their offset and move as one.
- Inherits: Constraint → Instance
- Creatable: Yes:
new WeldConstraint(), orInstance.new('WeldConstraint', parent). - Replication: Replicated: clients get a copy, and changes the server makes reach them.
A weld keeps part1 where it is relative to part0 when the weld is created (or enabled again),
and the two don’t collide with each other. Weld unanchored parts together to build vehicles and
objects that fall or roll as one.
Properties
Section titled “Properties”Inherited from Constraint: part0, part1, enabled
Inherited from Instance: name, archivable, id, className, parent, destroyed
Methods
Section titled “Methods”Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString
Events
Section titled “Events”Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged
Examples
Section titled “Examples”Weld a handle to a crate
Section titled “Weld a handle to a crate”import { Part, Vector3, WeldConstraint, workspace } from '@rally/sdk';
const crate = new Part();crate.size = new Vector3(4, 4, 4);crate.position = new Vector3(0, 20, 0);crate.anchored = false;crate.parent = workspace;
const handle = new Part();handle.size = new Vector3(1, 1, 3);handle.position = new Vector3(0, 22.5, 0);handle.anchored = false;handle.parent = workspace;
const weld = new WeldConstraint();weld.part0 = crate;weld.part1 = handle;weld.parent = crate; // they now fall as one