Wrapping up the twist module this week means there are no tasks left in Piper's To-Do list! There are some items left in the wish list that are not important for now and I am sure I'll find plenty of bugs as I start rigging and animating with Piper's rigging system. Now I can start animating the game's characters, woo!
Below is a short snippet on how to use Piper to rig a lower arm twist joint.
import pymel.core as pm
from piper.mayapy.rig import Rig
rig = Rig()
rig.prepare()
root_joint = pm.PyNode('SKL:root')
root_ctrl = rig.FK(root_joint, name='Root')[1][0]
hand_joint = pm.PyNode('SKL:hand_l')
lowerarm_joint = pm.PyNode('SKL:lowerarm_l')
left_lowerarm_twist_joint = pm.PyNode('SKL:lowerarm_twist_01_l')
rig.twist(left_lowerarm_twist_joint, lowerarm_joint, hand_joint, global_ctrl=root_ctrl, name='Left Arm')
rig.finish()
After running the code above, we get a root control, and a left lower-arm twist control that twists based on the weight attribute and the twist rotation of the hand joint as seen in the GIF below.
The weight attribute of the twist could be set to negative one to counteract the twist rotation of the given joint too! This is useful in upper-arm twist joints so the shoulder does not inherit the rotation of the arm chain.
The twist math is explained pretty well by Vasil Shotarov in his blog, while Chad Vernon takes it to the next level by adding a swing attribute and condensing the math into a single Maya node, which is what Piper is using.
And now that Piper is wrapping up, animation comes next! That is if I am not bogged down with classes, getting caught up with UE5, and Knockout City.
Comments