I've successfully set up a mesh that's deformed by an animated Bezier curve, with the help of the Animation: AnimAll utility, with one caveat: the mesh rotates inelegantly about the curve as it animates, in all available "Twisting" options. Ideally, I'd like to implement and distribute my own option with the following formula:
t = dot(v, axis)
v' = b(t) + rotationMatrixBetween(axis, b'(t)) * (v - b(t))
Where v
and v'
are input and output vertices, respectively, and b
is the cubic Bezier curve function. This has the effect of rotating every vertex by the same quantity that the associated Bezier tangent is rotated from the chosen axis
, giving a relatively stable animation.
So the question is, is it possible to implement an additional Twisting Mode as an addon to Blender? (Using the formula I described, ideally.) Or, is there a better alternative to achieve what I want? I'd like to export models consisting of simple shapes deformed by animated Bezier curves for the project I'm working on, and the formula I described is the one that I'm using.
Things I've checked or investigated:
- Both the model's and curve's origin are at
(0, 0, 0)
. - I've attempted all three twisting modes with every combination of "Bounds Clamp" and "Stretch", all with the same issue (understandably.)
- Browsing the source included with the release distribution hasn't been terribly enlightening for my use case. A full search reveals a
twist_mode
being set from the UI and in an import script, but not where it's used. - I could swap to a standard skinning approach as a last resort, but it's far more meticulous to create content with than what I'm wanting (which is, "ridiculously simple", Blender integration issues hopefully notwithstanding.)
UPDATE: Here's the packed blend file, as requested.
UPDATE AGAIN: browsing the actual source (now that I've found it) reveals an entirely C implementation of twisting that can't be extended without recompiling Blender (assuming bevel-handling code in curve.c
handles all twisting, bevel or no. I believe it is.) I believe "Minimum Twist" without correction for the first point would work well enough for me, if I could change it! Otherwise, maybe there's some way into tricking Blender to not correct for the first tangent in the curve?