Anchoring Objects

The Ultraleap plugin provides a couple of scripts that allow the anchoring of objects to both the hands and to other places in the world. This is great for Dynamic UI.

This page will briefly describe how to use attachment hands but for a better look at what you can do with hand attachments, check out the Hand Attachments page.

Note

Sample scene can be found in:

  • Assets/Samples/Ultraleap Tracking/VERSION/XR Examples/2. Interactions/4. Anchors.unity


Getting started with anchoring objects

Note

For this example, we assume that you have set up a scene to interact with 3D objects as is described in How to interact directly with objects in XR. And have an understanding of Hand Attachments.

  1. First add an Anchorable Object and an Anchor to the scene from the toolbar menu. These can be found in Ultraleap > Physical Interaction > Anchor / Anchorable Object.

  2. Place Both the anchor and the Anchorable Object within reach in your scene.

../../../../../_images/anchor-in-the-world.png
  1. Press play on the scene and you will be able to pick up the Anchorable Object and attach it to the anchor you placed in the world by moving the Anchorable Object close to the anchor before letting go.

../../../../../_images/attached-in-world-object.png

Anchoring objects to your hands

  1. Assuming you have followed the Getting started with anchoring objects section above, you will now need to add a set of attachment hands to the scene.

../../../../../_images/import-attachment-hands.png
  1. As explained in Hand Attachments, we will disable all attachment transforms of the attachment hand we do not want. For this example, we will be leaving the palm attachment only.

../../../../../_images/attachment-transforms-palm.png
  1. Child the Anchor underneath the palm. Your hierarchy should look similar to the one below.

../../../../../_images/attachment-object-hierarchy.png
  1. If you set the Anchor’s position to 0,0,0 in the inspector, the anchor will be set in the centre of the hand. You can move this to a position anywhere around the hand. We will move it to the pinky finger side of the palm.

Note

This anchor is now attached to the palm and will move and turn with the parent hand. We have found that the pinky side of the palm is the best place to place objects for easy interactions.

../../../../../_images/anchor-to-side-of-hand.png
  1. Press play on the scene and you will be able to pick up the Anchorable Object and attach it to the Anchor on your hand by moving it close before letting go.

../../../../../_images/attached-to-hand-object.png

Whats next?

Now you know how to anchor object in the world and in the players’ hand. You can use as many Anchors and Anchorable Objects in your world as you would like but we recommend using up to 4 on the players hand.

These objects can be used for many things such as inventories and even dynamic UIs for the player to carry around with them. Check out the Dynamic UI page.

If you are looking for a little more customization for the Anchor and Anchorable Behaviour, check out the references here: Anchorable Behaviour and Anchor