In Source1 all of the constraints were kind of hidden from us. The only way we could properly access them was through entities. This meant that every constraint you added in GMod was actually an entity.
This time around, constraints can be added and accessed directly from the physics world. This makes the API nice and clean.
We use a builder design for the constraint API, here's an example:
attribute 'blocktype' not allowedattribute 'contenteditable' not allowed
You access the builder for the constraint you want to build, the builders have all the functions that can set all the properties needed before creation. Properties can also be set after the constraint has been created.
There are 7 main types of constraints but on the C# side we can create pseudo constraints using a base constraint type. A good example of this is making a hinge which uses a revolute with limited default values.
attribute 'blocktype' not allowedattribute 'contenteditable' not allowed
You may be thinking, is the weld constraint wobbly like jelly or stiff and solid like you've always dreamed it would be?
The weld joint isn't perfectly rigid so should only be used as a locked constraint.
attribute 'blocktype' not allowedattribute 'contenteditable' not allowed
For real welding we need to attach entities and merge their collision shapes, this is already looking promising.
attribute 'blocktype' not allowedattribute 'contenteditable' not allowed
Weld joints still have some cool uses, they can be used to make a physgun!
attribute 'blocktype' not allowedattribute 'contenteditable' not allowed