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.
First add an
Anchorable Object
and anAnchor
to the scene from the toolbar menu. These can be found inUltraleap > Physical Interaction > Anchor / Anchorable Object
.Place Both the anchor and the
Anchorable Object
within reach in your scene.
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 theAnchorable Object
close to the anchor before letting go.
Anchoring objects to your hands¶
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.
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.
Child the
Anchor
underneath the palm. Your hierarchy should look similar to the one below.
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.
Press play on the scene and you will be able to pick up the
Anchorable Object
and attach it to theAnchor
on your hand by moving it close before letting go.
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