Pinholes constrain a rope to pass trough a specific point in space, while still allowing the rope to slide trough that point. This is easier to set up, cheaper and considerably more robust that using colliders for the same purpose.
Pinholes also allow for two-way coupling with rigidbodies (just like dynamic attachments) and are equipped with a motor. You can visualize this as a few motorized rubber discs around the border of the hole, holding the rope in place and forcing it to pass trough at a specific target speed. You can limit the force the motor is allowed to exert on the rope - so that it may find it difficult to pull ropes with heavy loads attached to them - and it's also possible to define the friction between the rope and the rubber discs, so the rope may slip.
You can add ObiPinhole components to a ObiRope or ObiRod. Let's take a look at the properties of the ObiPinhole component:
The transform of the object you want the pinhole to attach the rope to.
This is the initial position of the pinhole along the rope, expressed as a length-normalized coordinate: 0 for the start of the rope, 1 for the end.
It's important to realize that pinholes do not move the rope to the position of the target object, nor the target object to the position of the rope. Moving the rope to the target's position would result in a "kickback" effect once the rope springs back to its original position. Moving the target could cause a whole palette of issues depending on your game logic.
Instead, pinholes are created at the current position of the point defined by the coordinate parameter, relative to the target object. This makes it simple to work with multiple pinholes, and ensures smooth attachments with no initial "jumps" or sudden motions.
Note you can use the particles API to set particle positions at runtime before creating the attachment.
Friction between the pinhole's motor and the rope, expressed as a percentage: 0 will allow the rope to slide trough the pinhole with no resistance, regardless of the motor's target speed or maximum force. 1 won't allow the rope to slide at all, it will follow the motor's current speed.
Target relative speed bewteen the pinhole and the rope. Can have any positive or negative value, to move the rope in either direction. Note that the motor may be unable to reach the target speed if its max force is not large enough to move the mass of the rope and everything attached to it.
Maximum force the motor can exert on the rope.
Determines the behavior of the pinhole when reaching either end of the rope: when enabled, the rope will stop at the pinhole. When disabled, the rope will slide out of the pinhole.
Amount of force that must be exceeded for the pinhole to break.
Here's some helpful tips that will help you use pinholes effectively:
Pinholes do not constrain particle orientation: a rope and an object mutually constrained via a single pinhole are free to rotate around as they please. However, there's a trick to leave only one relative rotational degree of freedom: place 2 pinholes close to each other. Since the rope is forced to pass trough both pinholes, rotation can only take place around the imaginary line joining them.
A similar trick is often used with attachments.
Ropes in Obi are represented by a finite amount of particles joined by elements. Because of this, curvature does not change smoothly along a rope. Very sharp corners in the rope can become stuck in a pinhole when forces striving to pull the rope trough the pinhole are not large enough to overcome the corner:
Ropes with low bending compliance and low maximum bending - that is, ropes that cannot bend much - are less likely to be affected by this as they don't usually have sharp corners. However, if your rope must bend easily and may have sharp (close to or less than 90ยบ) corners in it, it may be a good idea to place sphere/capsule colliders around the pinhole to smooth these corners out as they approach it. The rope will then have a much easier time sliding trough the pinhole.
Pinholes allow for lots of use cases: ziplines, motorized cable cars, climbable vines, complex cranes, etc. Experiment with different settings to come up with exciting contraptions.