What I don’t understand is what happens when the rest angle becomes greater than 0.75PI. If I drag the “Angle Factor” slider around, I can see the hinge open and close and it behaves well for all values between 0 and and up to (but not including) PI (mesh vanishes at PI). But when I set the RestAngle to 0.76PI and reset the solver, the mesh starts flopping around and never settles down. What is happening above 0.75PI?
Note: If I grab a tip of the hinge as it is flopping around and move it slightly, it settles down and behaves nicely again.
The issue is that the hinge measures the current angle in a plane (perpendicular to the fold edge), and it can be between -pi and +pi. This is sometimes useful for certain applications, but in other cases is a liability.
If the target angle is close to pi, the momentum can carry it slightly past pi, so it folds through itself and then has a new angle of almost -pi, so thinks it has to make a full revolution to get back to the rest state, causing it to start spinning.
I think I could make a modification to the hinge goal to avoid this, such as detecting when it jumps more than pi in one iteration, or just have a boolean option to always take the short way round.
Okay, this fixes it. It’s a scripted goal, so you’ll need to set the assembly reference location by right clicking the C# component>Manage Assemblies, then locating your copy of KangarooSolver.dll (typically in C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Components). HingeFix.gh (11.5 KB)