update global rotation computation to use rig structure. #2