chinnei opened this issue on Apr 01, 2006 ยท 8 posts
lesbentley posted Sun, 02 April 2006 at 11:20 AM
The basic principle is quite simple. You add 5 lines of code to a channel that slave it to some other channel, eg:
targetGeom Biceps<br></br> {<br></br> name Biceps<br></br> initValue 0<br></br> hidden 0<br></br> forceLimits 4<br></br> min 0<br></br> max 1<br></br> trackingScale 0.00220658<br></br> keys<br></br> {<br></br> static 0<br></br> k 0 0<br></br> }<br></br> interpStyleLocked 0<br></br>
The first line is the type of slaving, almost always "valueOpDeltaAdd" though there are other types. The second line points to the figure that contains the master channel. The third line points to actor that contains the master. The fourth to the master channel itself. There is nothing special about a master channel, it is a master only because some slaved channel points to it. The fifth line is a controle ratio, the amount the slave will be affected by the master.
The above example is the start of a targetGeom (morph) channel to bulge the bycep, it is slaved to the "rotateY yrot" in the forearm, so when the forarm bends the bycep bulges.
A channel may be slaved to a master in the same actor, in any actor below it in the parenting hierachy, or in an actor one step above it (but no more) in the hierachy, thus a channel in the thigh may be slaved to a channel in the shin, but not to one in the foot (there are workrounds, but beyond the scope of this post).
There is a lot more that could be said about ERC, but the above are the basics, and enough for most situations.
I will just add one more point. When you inject slaving (or a channel that contains slaving) via a pz2 file, you should use a slightly diffrent format in the slaving code, leave the actor and figure numbers out of the code, eg use:
valueOpDeltaAdd<br></br> _NO_FIG_<br></br> rForeArm<br></br> yrot<br></br> deltaAddDelta 0.005000
This ensures that the slaving code will receve the actor number of the figure that is selected when the pz2 is loaded, failure to use this format can result in the channel becoming slaved to the wrong figure.
For more info on ERC/EMC see these links: