Aligning skeletons according to a bone

Hi everyone,

I’m trying to align all my skeleton poses (hundreds) using one of the bones as reference but couldn’t make it to work. Before I translated all center_of_mass to the origin (0,0) and it was fine. But now I tried to apply a rotation matrix (clockwise direction; using orientation angle (theta) from ‘analyze_skeleton’ output), but it doesn’t work…

my rotation matrix = [cos(theta),sin(theta),0;sin(theta),cos(theta),0;0,0,1];
obs: theta is already converted to radians.

Any suggestions are welcome…

all the best,
R.

erratum:
my rotation matrix = [cos(theta),sin(theta), 0;-1
sin(theta),cos(theta), 0;0,0,1];