microsoft / MixedReality-WorldLockingTools-Unity

Unity tools to provide a stable coordinate system anchored to the physical world.
https://microsoft.github.io/MixedReality-WorldLockingTools-Unity/README.html
MIT License
188 stars 45 forks source link

AlignmentManager Wipes Previous .fwb At Start #185

Closed Waffle1434 closed 3 years ago

Waffle1434 commented 3 years ago

I was expecting the OMPTest scene to persist the manual world alignment of the pins. It appears to almost do this, but in practice it is resetting the pins to the default pose, as if "Clear Alignment" was hit.

I set some breakpoints, it appears AlignmentManager is resetting, clearing, and saving the cleared alignment at start. This results in all of the the previous session's Space Pins to be overwritten and deleted in Alignment.fwb, which is then loaded causing this behavior.

I believe to have a solution, this may not be the best one though.

I modified ClearAlignmentAnchors to support optional saving:

public void ClearAlignmentAnchors(bool save = true)// AlignmentManager.cs / IAlignmentManager.cs
{
    poseDB.Clear();
    if (save) CheckDBSave();
    referencePoses.Clear();
    referencePosesToSave.Clear();
}

and WorldLockingManager's Reset to not save:

public void Reset()
{
    AnchorManager.Reset();
    FragmentManager.Reset();
    AlignmentManager.ClearAlignmentAnchors(false);
    AlignmentManager.SendAlignmentAnchors();

    Plugin.ClearFrozenAnchors();
    Plugin.ResetAlignment(Pose.identity);
}

This appears to create the desired behavior, the previous session's alignment is loaded, but if the "Clear Alignment" button is hit, the cleared state is saved for future sessions.

Unity 2019.4.28f1 WLT 1.3.0 (Downloaded from MRFT last week) using World Locking Context Target Platform: HoloLens 2

fast-slow-still commented 3 years ago

Hi @Waffle1434 , this could be a regression from a bug I fixed recently (last few months), but I can't tell from your bug report. Could you augment your issue with the following information?

Unity version WLT version (found on the World Locking Manager object's World Locking Context component. Target platform(s) (one or more of HoloLens, HoloLens2, Android, iOS) Anchor subsystem (found in World Locking Context/Anchor Management/Anchor Subsystem)

And if you could attach a UnityPlayer.log (or equivalent), that would be great.

See the docs for more information on providing the most useful bug reports.

Thanks!

Waffle1434 commented 3 years ago

Added some more info

fast-slow-still commented 3 years ago

Thanks @Waffle1434 , I believe that bug was fixed a few minor versions back. I have tested and verified correct behavior on the WorldLockingPhysicsSample scene (and others). You should try with version 1.4.0.

On the MRFeatureTool, it doesn't actually automatically check for new versions. I've filed an issue on it, but I don't think it's been addressed yet. You have to manually refresh to get offered the latest. See screen below.

MRFeatureToolRefresh

Also, I noted elsewhere, the OMPTest scene is almost certainly not what you want. If you let me know what you are interested in doing, I would be happy to try to help you find a more suitable sample to work from.

Thanks!

Waffle1434 commented 3 years ago

I was interested in having a pin to align the world to a photogrammetry scan of an area and have it remembered. I was able to twist OMPTest to my purposes for now

fast-slow-still commented 3 years ago

Sounds good, let me know if I can be helpful. Best wishes...