Unable to animate via blueprint

So, i’m trying to load animation from bvh files directly into the game.
I wrote two c++ functions, one to parse the bvh and get bone names and rotations, one to retarget to a given character (comparison of bones).
Both functions do their job, but when i try to apply the rotations (i used the set bone rotation by name), the result is a big mess.
I hardcoded a bit to map the coordinate systems of all the bones in the mocap file and in the character’s skeleton and i multiplied the trasformation matrix from every single bone times the transformation for the reference pose times the rotations, the result was sligthly better but still far from the real animation.
I don’t understand what’s the source of error, teh different skeletal mesh, the fact that UE4 doesn’t use an orthonormal coordinate system (an d i don’t get why) or anything else.
Anyone have tried doing something similar and could help me?