I can’t adjust the weapon’s fixation to the hand and its direction

I’ve been trying for a week now to make my character and the AI ​​that I make point the weapon exactly where they are looking. In the case of the player, this is the center of the screen, and if the AI ​​sees the target, it aims at the target.

This is how I check and write down directions to the goal by hand. I also write down the direction variable. This is not a definitive method for checking direction, so it’s not worth focusing on here.

And I just write it down as a new weapon twist.

As you can see in the picture, the weapon sight and target direction are different.

This is easy to fix, but the weapon stops aiming in height.


In general, this approach is limited, and I realized that I would not be able to attach both hands to the weapon in this way so that they would be normally fixed on it.

I tried changing the rotation of the Hand_R brush, but I can’t set the exact direction, with any method of applying rotation I did not get the desired result.
image

I know that the best scheme is to use virtual bone, they also allow you to make a high-quality binding of both hands to the weapon, which will allow the hands to accurately maintain positions on the weapon. But I’ve been trying to do them for almost 3 days but nothing works.

I tried following the documentation - Virtual Bones in Unreal Engine | Unreal Engine 5.4 Documentation | Epic Developer Community, but nothing helped. In general, I am also studying AdvancedLocomotionSystemV and applying practices from this asset in my project, and I realized that everything comes down to virtual bones. I changed the binding to my socket and immediately saw a result similar to mine.

To summarize, 1 there is no point in aiming only the weapon since the animations do not adjust, 2 the brush does not want to be directed clearly along the path (I probably didn’t work this out), 3 I don’t understand how virtual bones work and how I can attach a weapon to direct it on target. I thought for a very long time about what to do, but there was no insight. I don’t think, that I can cope without outside help. I will attach a file with the character and his skeleton.

I would be very glad if someone explains how to do this.