[Closed] Bones driven by flex modifier
Hi all,
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)
try(
delete $'*_IK*'
delete $'*flexor_*'
delete $'*CTRL_*'
)catch()
max select all
fn newLine =
(
nl = splineShape pos:[0,0,0] wirecolor:orange
AddNewSpline nl
addKnot nl 1 #corner #line [0,0,0]
addKnot nl 1 #corner #line [0,0,10]
AddNewSpline nl
addKnot nl 2 #corner #line [2,0,12]
addKnot nl 2 #corner #line [0,0,10]
addKnot nl 2 #corner #line [-2,0,12]
updateShape nl
nl.name = uniqueName "flexor_"
nl
)
lastIk = undefined
sa = selection as array
n = point pos:sa[1].pos wirecolor:red name:(uniqueName "CTRL_")
sa[1].parent = n
for o in sa do
(
if o.children[1] != undefined then
(
ikNode = IKSys.ikChain o o.children[1] "IKHISolver"
ikNode.name = o.name + "_IK"
ikNode.transform.controller.SAParent = 0 -- Set ParentSpace (kills flips)
(s = newLine()).pos = o.children[1].pos
f = flex flex:1 strength:4 sway:7 solver:2 samples:3
f[11].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”.
Thanks,
-Johan
I get an error as soon as I run the script. Unknown position and rotation in objects that you are trying to call.
hmm that’s weird, works fine here with a freshly started max.
Did you make a new scene with a bone chain in it?
Also note it’s for max2008+ or AVG installed.
Thanks for taking a look!
-Johan
Tried here with MAX 2008 and it works OK. But I can’t help you with your problem, sorry…
if I understand, you’re trying to avoid some kind of dependency loop…
I suppose there’s a way, but the simplest, would be with 2 chains:
Ruramuq: That’s a very interresting rig… also would allow for some seamless blending of flexed and static animation… thanks I’ll chew on that a bit more.
Thanks!
-Johan
p.s. thinking about it you would even need the extra bones, you could animate the parented “flexors”…
What Ruramuq has shown you, or at least the premiss is exactly the way I go about it. You always want to be able to ramp on and off any automation that you are going to add to a character. It isn’t always what you want. Some times a double chain like that is the simplest and fastest way to set it all up with the least about of issues.