blurstudio / TwistSpline

A smoothly reparameterizing Bezier spline that also interpolates orientations
MIT License
92 stars 42 forks source link

Add an euler filter to the cv-orient twists so we don't get unintended flipping #35

Closed tbttfox closed 3 weeks ago

tbttfox commented 3 weeks ago

If all of the CV's have 'useOrient' set to 1, and the first and last CV's twist past 180deg relative to each other, and the intermediate CV's are twisted to show a bit of blend, we can get flipping to show up randomly between the intermediate CV's.

The best solution I had is to run an Euler filter down the twists that are controlled by the CV orientation.

tbttfox commented 3 weeks ago

If you run this, and then twist the last cv, you can see the flipping.

makeTwistSpline('tmp', 5, numJoints=0, spread=3.0)
cmds.setAttr("Ctrl_X_tmpSpline_Part02.rx", -53)
cmds.setAttr("Ctrl_X_tmpSpline_Part03.rx", -162)
cmds.setAttr("Ctrl_X_tmpSpline_Part04.rx", -197)
cmds.setAttr("Ctrl_X_tmpSpline_Part05.rx", -310)
spline = r'Rig_X_tmpSpline_DrvShape'
cmds.setAttr(f"{spline}.debugDisplay", 1)
for i in range(5):
    cmds.setAttr(f"{spline}.vertexData[{i}].useOrient", 1)