Pin constraints

By now you know that Obi particles can be fixed in the actor's local space, so they donĀ“t move at all relative to the actor. However if you parent the ObiCloth object to a rigidbody, all fixed particles will just mimic the rigidbody movements without exerting any forces upon it. Which means, cloth will react to the rigid body movement but the rigidbody won't react at all to the cloth.

Enter pin constraints. Pin constraints allow you to attach cloth particles to a rigidbody, stablishing a two-way energy exchange channel: particle movements will affect the rigidbody, and rigidbody movements will affect the particle.

Unlike most other constraints, pin constraints aren't stored in a blueprint. They are automatically created and managed by dynamic particle attachments.

A good example is a wind-driven ship. The sails should follow the movement of the ship, but they also have to be able to propel the ship when the wind blows. So a good idea is to attach the sails to the ship using dynamic attachments.

Using dynamic attachments (pin constraints) to create a physically simulated sail.

Two particles pinned to a capsule.

Pin constraints and collisions

When pinning a particle very close to or inside a collider (so that they overlap), if you have collision constraints enabled you can encounter a situation in which both constraints fight each other. This results in jittering and/or an undesired offset in the pin position, because the collision and pin constraint cannot be met simultaneously. If the particle is pinned to a rigidbody, results will be even worse as this setup causes a force feedback loop with largely undefined behavior.

Rope pinned to a collider. The pin constraint (shown in cyan) tries to keep the particle inside the collider, but the collision constraint tries to keep it outside. Collisions have higher priority than pin constraints, so they "win". The red numbers in the collider/particles are their phase values.

The solution is to use phases to filter out collisions between the pinned particle and the collider. See the collisions page for more information on how to set up collision phases. By setting the particle phase value to the same as the collider's, no contacts will be generated between them and collisions will not interfere with the pin constraint.

By setting the first two particle's phase values to the same phase as the collider's, collisions are filtered out and the pin constraint can do its job uninterrupted.