-
-
Notifications
You must be signed in to change notification settings - Fork 108
Constraints
Marc Flerackers edited this page Aug 30, 2025
·
9 revisions
Currently there are the following constraints:
- Translation
- Rotation
- Scale
- Transform
- Distance
These constraints all work in world space. For example, distance is measured in world space, not local space. So even if an object scales times 2, a distance of 200 pixels is still 200 pixels in world space, not 200 pixels in local space, which would be 400 pixels in world space.
In progress:
- IK constraint
Planned:
- Path constraint
Nomenclature:
- Root: The start of the IK chain
- End effector: The end of the IK chain, which tries to reach the target.
- Target: The point for the end effector to reach.
constraint.ik(target, {
algorithm: "ccd",
depth: 2,
strength: 1
});Parameters:
- algorithm:
- FABRIK (Forward And Backward Reaching Inverse Kinematics): Fast, but unable to use angle constraints.
- CCD (Cyclic Coordinate Descent): Slower, but can use angle constraints.
- depth: Defines the actual IK chain. A depth of 2 means that the chain root is two parents from the end effector.
Angle constraints can be set (if using CCD) using a bone component.
bone({ minAngle: -180, maxAngle: 180 });constraint.path(path, {
distance: 0,
offset: vec2(50, 50),
followMotion: true,
strength: 1
});