View Full Version : creating a bicep muscle bone that buldges based on elbow rotation in IK
03 March 2006, 02:33 PM
I'm writing this on route and away from my workstation...typing from memory. excuse me for being so wordy. my question is at the bottom of the following background.
I was creating a buldging bicep bone on my character's humerus and wondered how to slow down the amount of X movement the nub bone on the bicep bone would move in conjunction with the two point helpers I linked to both the humerus and forearm bones.
1. positioned a point helper ("distBicepP") at the center of the forearm along where the radius bone would be then zero'd it's transform values.
2. positioned a second point helper ("distBicepD") at the center of the humerus bone where the bicep would buldge (front of the the humerus bone)
Now when the forearm and humerus bend at the elbow towards each other, these two point helpers will follow along their parent bones and get closer to each other until they are almost right on top of each other. of course the rotation at the elbow will not get this far...but I wanted to give some visual clue for these two helper objects and what they will do.
3. drew two more helper objects but positioned them both where the actual muscle bone ends would be. in this case, one would be where the elbow bends "bicepElbow" and the other just below the shoulder area "bicepShldr"
4. drew a single joint bone from the bicepShldr to the bicepElbow helpers and set it's bone properties to "stretch" and reset the Scale/Stretch values.
5. position constrained the nub bone from step 4 to bicepElbow helper
6. look-at contstrained the root bone from step 4 to bicepElbow helper while setting the upnode to be the bicepShldr helper, linked the root bone to bicepShldr helper.
7. replaced the nub bone's X position under the zero'd out pos controller to be an Expression Controller.
Expression Controller's settings:
set up one scalar constant variable called "Rcon" that was set to the distance between distBicepD and distBicepP helper objects: maxscript listener distance $ $ with both helper objects selected gave me my value for this variable. I took this value with the arm stretched out to it's max (Ik goal at the wrist moved until the elbow was straight).
set up two vector variables:
bE assigned to the bicepElbow point helper
bS assigned to the bicepShldr point helper
if (length (bE-bS)-Rcon<10,(length (bE-bS)-Rcon/2),0
the 10 represents when the underlined value is assigned to the X position of the nub bone within the bicep muscle. if it's false then the nub bone should stay where it is. the value of 2 seemed to decrease the starting position of the nub bone.
I want to be able to make the position movement stop at a certain distance between bE and bS.
what would be a better equation to ensure that when the distance between bE and bS get less than 10 do A else if less than 2 do B else do C? basically, how would one write an if/else if/else statement within Expression Controller ?
03 March 2006, 04:26 PM
Why not just use the rotation of the elbow joint. If it is not animated directly, ie;with an IK solver instead, then drop in an Expose Transform helper object and add the forearm bone to as the expose node and then wire to the exposed Local axis that you need. Far easier and more acurate then what you are trying to do.
03 March 2006, 09:18 PM
thanks for the tip PEN ... I'll have to read up on the Expose Transform helper...using max v7
03 March 2006, 02:51 AM
it worked...a much easier method than the one I stratched my head over yesterday.
Just so I can understand what I did...here's what I typed into the wire parameter (just three lines) for the nub bone's X position (zeroed out the value with a second Position XYZ), which was connected to the ExposeTransform's Local Euler Z value.
-- this assigned the variable Rbicep with the current rotation of the forearm minus the 'posed' forearm's rotation - when the IK handel is at the same location when it was created, in effect 'zeroing' out the forearm's Z rotation from the 'posed' state.
if ($etHLP_R_ELBOW.localEulerZ > (degtorad 150.0)) then
-- this verifys if the current rotation of the forearm is greater than 150 degrees then do something, I guess one has to say degtorad here so that max knows I'm referring to degrees yes? I was thinking that the condition should be testing for less than and not greater than 150 (150 degrees is where the forearm is bent all the way) but when I replaced > with < symbol, max came up with an error (when I updated the wire parameter). The greater than symbol (>) turned up no error and worked as I wanted so I left it, but I cannot explain why. I want the bicep nub bone's position to start changing as the rotation value of the forearm increases from it's posed state, which it does with the > symbol.
Rbicep/20 else 0
-- when the above IF statement proves true the nub bone's X Position value equals Rbicep divided by 20 (twenty so that the position change effect will be a much smaller value), else if the conditional statement turned up false, the nub bone's X Position value should be zero (left alone).
Any suggestion or comment?
Thanks in advance.
03 March 2006, 05:51 PM
If it works it is good:)
03 March 2006, 11:57 AM
Thanks for exposing, virtualmesh ;)
03 March 2006, 11:57 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.