I've hit a bump in trying to utilize the flex modifier to drive a bone chain.
Create a empty scene and make a bone chain (doesn't matter really how long).
Run this script (max2008 and up, because of "getPointPos" in the scriptcontroller from AVG)
max select all
fn newLine =
nl = splineShape pos:[0,0,0] wirecolor:orange
addKnot nl 1 #corner #line [0,0,0]
addKnot nl 1 #corner #line [0,0,10]
addKnot nl 2 #corner #line [2,0,12]
addKnot nl 2 #corner #line [0,0,10]
addKnot nl 2 #corner #line [-2,0,12]
nl.name = uniqueName "flexor_"
lastIk = undefined
sa = selection as array
n = point pos:sa.pos wirecolor:red name:(uniqueName "CTRL_")
sa.parent = n
for o in sa do
if o.children != undefined then
ikNode = IKSys.ikChain o o.children "IKHISolver"
ikNode.name = o.name + "_IK"
ikNode.transform.controller.SAParent = 0 -- Set ParentSpace (kills flips)
(s = newLine()).pos = o.children.pos
f = flex flex:1 strength:4 sway:7 solver:2 samples:3
f.value = [0,0,10]
addModifier s f
--s.parent = if lastIk != undefined then lastIk else o -- uncomment this to make max crash
s.parent = n
sc = position_script()
ikNode.position.controller = sc
sc.addNode "n" s
sc.script = "in coordsys world getPointPos n 1"
lastIK = ikNode
with animate on
at time 10 n.rotation.z_rotation = -80
at time 25 n.rotation.z_rotation = 80
at time 35 n.rotation.z_rotation = 80
at time 50 n.rotation.z_rotation = -180
at time 60 n.rotation.z_rotation = 0
This seems to work, but it's not giving the results I want, I want to drive the flexors with the IKnodes, so the animation doesn't only come from the CTRL but from the flexors parent IKnode, making it react to that. Thus being able to make it wave. Which can not be done with parenting the flexor to the CTRL only.
I can parent 1 flexor to it's predesesing IK node but parenting another makes it unstable and parenting 3 in a row, makes max crash.
How would I go about setting this up, to be able to make it "wave".