how to extend default VR grab component to mesh socket snapping ?

In the default VR template, I would like add the VR hand mesh as a preview asset to the GripPoint socket of the pistol. Then rotating and relocating that GripPoint socket, so that the VR hand is perfectly aligned to the pistol grip. Later I would like to snap the pistol mesh to this aligned socket transform by the grab component.

To attach the pistol to the VR hand instead of the motion controller, I passed a reference of the B_MannequinsXR to the grab component and then added a macro ‘AttachParentToVRHand’ for it.

So far so good, the ‘attach component to component node’ allows to specify a socket, but as default the parent is the the VR hand, so it never takes the socket name of the pistol.

You can tell now, then why not create a socket on the hand mesh and attach the pistol to that one!? This is actually working, but then I would have to add a socket to the VR hand mesh for every single item that needs custom snapping, and it’s not very intuitive to take the hand mesh, add there a socket and another mesh as preview and then adjusting the socket.

In the macro I changed to parent to be the pistol and the VR hand as to attached component. Then attachment to the grip point of the pistol is working, but then as the VR hand is attached to pistol I can no longer move it. Tested only with the right VR hand mesh.

My question is now, how to get the pistol aligned to its socket transform or how to pass the socket transform to the hand in order to get the pistol to be attached to its grip?

Solved by myself, once again :triumph:

The key was to align the grab component to the mesh socket and let the existing code do the rest.