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

Object offset after tracking loss #234

Closed NLR-L closed 2 years ago

NLR-L commented 2 years ago

Sometimes after having experienced a tracking loss, all my objects that were lined up with the real world before have an offset of 0.5-10 cm. For most of our use cases that would be fine, when anchors are used to place objects for interaction the user wont remember it that accurately anyways, but we try to match the object position to a point on the mesh.

WLT seems to think that it correctly lined up. It can be hard to notice, but at the start the objects are perfectly lined up with the real world and after the "tracking lost" they've drifted.

I think it's the same issue is #232, except that I don't even use the subtree.

Edit:

I'm having troubles pinning down what's going wrong, because sometimes it recovers just fine and other times it's messed up by a small offset.

The spatial mapping itself looks fine, but if I make a copy of it, the copy will have a small offset after some "tracking losts", while the actual mesh still has the good position. This might be because the mesh gets an update after tracking lost from the mesh observer.

fast-slow-still commented 2 years ago

Hi @NLR-L , could you clarify this a little? What kind of objects have drifted? Are these HoloGrams, or the spatial mapping mesh? Thanks!

NLR-L commented 2 years ago

The objects that have drifted are the holograms. I tried to explain that if I create a copy of the spatial mapping mesh, that the copy will be at a slightly different position than the actual spatial mesh after the tracking was lost. In this case it was easy to verify the offset, because I could compare the two meshes.

I will try to create pictures of the problem, but I'm really busy at the moment, so that might take a while.

fast-slow-still commented 2 years ago

Thanks for the clarification. This could be an issue with the refit operations. Two things you might try (one at a time) are:

  1. Disable automatic refit operations - in WorldLockingContext, set Auto-Merge and Auto-Refreeze to false (unchecked).
  2. Add AdjusterMoving components to the root of your holograms. This applies any adjustment calculated during the refit operation to reposition your holograms in virtual space to go back into place in physical space.

I would be very interested to hear back if either or both have any effect. No rush on my behalf, I appreciate you taking the time.

Thanks!

NLR-L commented 2 years ago

Some quick tests seem to make me think that solution 2 solves the problem for me. Thanks for your help :)!

It also makes sense when reading the documentation since I'm trying to line up the virtual object with the physical world. And they're talking about attachment points when you need that kind of accuracy.

fast-slow-still commented 2 years ago

Fantastic! Thanks for the update!