How to attach your nodes in the VR hierarchy ?

Once you have configured that the hand of your user is moving with a tracker, you might want that a 3D object that you've created moves with the user's hand.

For example you might have added a tennis racquet to your project and want it to be attached to the user's hand.

There are two options for that :

- the "Grab Existing Nodes" property of the VR manager,

- and the "VR attach to Node" script.

Grab existing nodes

The easiest option is to give your object the same name as a node in the VR hierarchy and check the "Grab Existing Nodes" option of the VR manager.

If this option is activated, when the VR manager initializes, it will parse the scene for nodes that have the same name as the nodes in the VR hierarchy, and insert those instead of creating an empty GameObject.

For example if in the VR hierarchy there is a node named HandNode, and you named the parent of your 3D racket model also HandNode, the VR manager will simply "grab" this node and insert it in the VR hierarchy. The VR manager will then use this node as a parent for the rest of the sub-hierarchy :

The children of your 3d model will all be moved with its parent :

Attach to node

The second option is simply to attach the "VR Attach to Node" script to the node that you want to insert in the VR hierarchy.

You can find this script in the "Scripts/Interactions" folder of the MiddleVR package.

The final step is to specify the name of the node in the VR hierarchy that you want as a parent for your object.