itsjustme Posted September 20, 2007 Share Posted September 20, 2007 I've been using this little setup quite a bit in the past week and thought it might be useful to others, so, here's an example model. This is the result of needing to be able to use a Pose slider to set a translate limit and having it work as far back as v11.1...it's one of the things I'm using to make the bones rig for the face in the Squetch Rig easier to install. The "controlled_bone" is the bone that is being translated and limited, the "controller" is the bone you manipulate, the "Y_distance" bone's 'Z' scaling is to pass the 'Y' translation distance into the equations, the "limiter" bone's 'Z' scaling is used to set the translate limit that is greater than "0" on the "controlled_bone" and the "scaler" bone's 'Z' scaling is used to set the percentage of translation for the "controlled_bone". First, I made the "percentage" Pose...this is a percentage slider that has a value of 0-100. At 100%, the "scaler" bone's 'Z' scaling is set at 100% and at 0% the scaling of its' 'Z' is at 0%. Next, I made the "limit" Pose...this is a percentage slider that has a value of 0-10. The reason it is 0-10 is that I'm going to have those numbers reflect actual distances and I won't need more than ten inches. At the "10" value of the slider, I set the 'Z' scaling of the "limiter" bone to 10% (I could have used 100%, but this will leave me options if I need them in the future) and at the "0" value of the slider its' 'Z' scaling is at 0%. Then, I made an ON/OFF Pose for the Expressions that drive this setup...I used an "If()" Expression for both. An "If()" has three values in it...it goes like "If(this is true,do this,if not do this)". Here's the Expression that transfers the 'Y' translation of the "controller" bone and sets a lower limit of "0" using the "Y_distance" bone to transfer the values: Y_distance=Transform.Scale.Z=If(..|..|..|..|controller.Transform.Translate.Y>0,..|..|..|..|controller.Transform.Translate.Y/254,0) What this says is, If(the 'Y' translation of the "controller" bone is greater than "0",use the positive 'Y' distance the "controller" travels divided by 254 as the 'Z' scaling value for this bone, otherwise the 'Z' scaling value of this bone is "0"). Dividing by 254 is to convert from a translate type of value to a scaling value. The last Expression is to actually move the "controlled_bone". Here's what it looks like: controlled_bone=Transform.Translate.Y=If(..|..|..|..|limiter.Transform.Scale.Z>(..|..|..|..|Y_distance.Transform.Scale.Z)*..|..|..|..|scaler.Transform.Scale.Z,(..|..|..|..|Y_distance.Transform.Scale.Z*254)*..|..|..|..|scaler.Transform.Scale.Z,(..|..|..|..|limiter.Transform.Scale.Z*254)) What this says is, If(the 'Z' scaling value of the "limiter" bone is greater than the 'Z' scaling value of the "Y_distance" bone multiplied by the 'Z' scaling value of the "scaler" bone,use the 'Z' scaling value of the "Y_distance" bone multiplied by 254 multiplied by the 'Z' scaling value of the "scaler" bone as the 'Y' translate value for this bone, otherwise the 'Y' translate value is the 'Z' scaling value of the "limiter" bone multiplied by 254). Multiplying by 254 is to convert a scaling value to a translate value. This model should work from v11.1 to the present version. Set the limit to a value between 0-10, set the percentage between 0-100%, then move the "controller" bone on the 'Y' axis (vertically) to see the resulting movement to the "controlled_bone". Hope this is helpful. v12_expression_translate_limit_example_09_20_2007.zip Quote Link to comment Share on other sites More sharing options...
Ramón López Posted September 29, 2007 Share Posted September 29, 2007 Hello! Well, maybe I be not in the "level" to take advantadge yet of all this incredible stuff but I have been always very interested about expressions and the unlimited posibilities it opens, so I hope to be prepared for it someday and I'm sure when that happen (if that really happen...), this kind of examples and explanations will be, or had been, like the most GREAT & USEFUL help, and well... I only wanted to say you THANKS in advance for that! ...Ouh, you don't know how I'd love have a mathematical brain like that one you have... Well... TAKE CARE (OF IT)!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.