Hello, I am working on creating an end effector for my scene in Unity. I am trying to follow these steps:

Compute a translation matrix for each bone.

Compute a rotation matrix for each joint.

Multiply the matrices to get the full transformation matrix.

Then extract the position and orientation from this matrix.
I want the effector to appear at the top of my structure.
My issue is finding the correct formula to get this to work. When I fix the translation matrix, it messes up my rotation matrix. Any info is helpful. Here is my code:
Here is my tree: