Trying to write my first script here and am running into some issues.
What I want to achieve -
A tool that you can use to make one curve take the shape of another.
A simple example -
Lets say I have two vector layers and both of them have a single curve with 4 points inside. The curves have different point positions and curvatures. With the Layer 1 active I can use this tool to select the curve un Layer 2. By doing so the curve in Layer 1 would take the exact shape of the selected curve. The shape would be maintained identical throughout animation as the curve in Layer 2 is deformed with actions / smart bones etc.
What I have so far -
1. I've dissected the follow path tool to get the "selecting curve functionality"
2. I can loop over the points of the curve in the active layer and set their position to match the other curve
What I need help with -
1. How to correctly copy over the curvature from one curve to the other? I tried using :GetCurvature() and :SetCurvature() and that sometimes worked but mostly did not. I guess I don't fully understand how the curvature is stored/defined.
Code: Select all
local followCurvature = followCurve:GetCurvature(i)
activeCurve:SetCurvature(i,followCurvature,0)
3. Extra question - is there a way to quickly refresh the tool script without closing Moho?
Any advice will be greatly appreciated!
Thanks!
Toms