Help with rotations/quaternions

Hello everyone!


I have been smashing my head trying to understand rotations and quaternions. I am trying to do a transform controller for a Katana when is grabbed by 2 hands (VR controllers). I want to control the Pivot based on the position of the controllers as shown in the GIF, but I also want to control the katana edge orientation based on the average of the forward orientation of the controllers. In other words, in the gif the katana edge orientation should be always forward until I start changing the rotation of the controllers.
Any insight on how to tackle this problem?


Solved with help from the unreal engine subreddit: