Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to (really really) delete an object's WorldAnchor from the store?

So my project's current scenario is that we'd like to have a version of the TaptoPlace script that's in the Holotoolkit attached to a Hologram, but allow all users attached to the current session to see the hologram at the current location in between placements. To do this, we've got a similar setup to the TaptoPlace demo, only with a Sharing prefab (and thus using SharingWorldAnchorManager rather than WorldAnchorManager). The gameobject that's being placed is HologramCollection, which contains a single Unity Cube as a child. Our TaptoPlace is attached to HologramCollection. We are also used the AnchorDebug prefeb to view how the anchors are being manipulated.

Currently, we're getting behavior that we don't understand. Basically, no matter what we do to remove the HologramCollection anchor during the times where's it's being placed, once HologramCollection is placed, the WorldAnchorManager seems to detect an existing anchor and reimports it from the store, which resets HologramCollection to the position it was in when the app first loaded. This isn't the behavior that we want - we want the hologram to be at the place it was placed.

Here's what we've tried to get the behavior we want:

  1. Letting the TaptoPlace script rock as it, which appears to use versions of WorldAnchorManager.Instance.RemoveAnchor(PlaceParentOnTap ? ParentGameObjectToPlace : gameObject);
    and
    WorldAnchorManager.Instance.AttachAnchor(PlaceParentOnTap ? ParentGameObjectToPlace : gameObject); to manage the objects. I only bring this up because during this option, DebugAnchor will report that the HologramCollection anchor has been deleted, but then immediately reimports a new one, presumably from the anchor store associated with the room.

  2. Try to remove the HolgramCollection manually from the store by adding the following code:

In TaptoPlace's Start function, we added WorldAnchorStore.GetAsync(StoreLoaded); to get at the store, added a StoreLoaded function to run the Anchorstore = store; Anchorstore.Clear(); code, and then added the following to TaptoPlace's RemoveAnchor function: var anchor = this.GetComponent<WorldAnchor>(); if (anchor) { // remove any world anchor component from the game object so that it can be moved DestroyImmediate(anchor);

This option results in initially getting the same successful delete message, following by a set of failure to remove/delete anchor messages, and the same overall behavior for HologramCollection.

  1. Same as option 2, but in RemoveAnchor, we instead used: this.Anchorstore.Delete(this.name.ToString()); as our option to remove HologramCollection's. This time, we get no successful delete messages, one failed to delete message, and an instant teleport of the HologramCollection object from the placed location back to it's original location.

My fear is that we don't really understand the concept of anchors as they relate to the anchor store. The documentation we have read seems to indicate that at least some of these commands should have deleted the anchor from the store, but it seems like the commands are only deleting the anchor from our local Hololens. Any help or insight here would be appreciated!

Sign In or Register to comment.