The main object in our app gets an anchor after two seconds of not being manipulated. For most objects this goes without a problem. Some objects completely disappear after getting an anchor.
After logging some stuff, I found the following. First, I exactly print out the lossy scale, word position and world rotation, and I get:
Ensuring anchor for (Transform) Patient3D Hologram ; lossyScale: (1.00, 1.00, 1.00), world pos: (-0.29, 0.78, 0.62), world rot: (0.00000, 1.00000, 0.00000, 0.00000)
Directly after that I add the anchor. Basically, “gameObject.AddComponent<ARAnchor>”
Like I said, for most objects this goes without a hitch. However, some objects completely disappear, and then I see in the log the following three errors:
Msg: Error: XrCreateSpatialAnchorsAsync in the Magic Leap API failed. Reason: PoseInvalid
StackTrace: UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
MagicLeap.OpenXR.Utils:DidXrCallSucceed(XrResult, String, Predicate`1, Boolean)
MagicLeap.OpenXR.Subsystems.MagicLeapProvider:TryAddAnchor(Pose, XRAnchor&)
UnityEngine.GameObject:AddComponent()
Msg: XRAnchorSubsystem: Error creating Anchor at ((-0.29, 0.78, 0.62), (0.00000, 1.00000, 0.00000, 0.00000))
StackTrace: UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
MagicLeap.OpenXR.Subsystems.MagicLeapProvider:TryAddAnchor(Pose, XRAnchor&)
UnityEngine.GameObject:AddComponent()
XRAnchorSubsystem: Failed Deleting Anchor from Subsystem 0000000000000000-0000000000000000
StackTrace: UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
MagicLeap.OpenXR.Subsystems.MagicLeapProvider:TryRemoveAnchor(TrackableId)
UnityEngine.GameObject:AddComponent()
For the sake of being thorough, my OpenXR settings:
What the hell is wrong with this seemingly perfectly valid pose? Also, this happens always with some objects. It is perfectly reproducible. Other objects never fail. So it is not a tracking issue. For some reasons, one object always fails, some objects never. I have to add it is a large-ish compound object. However, with no anchor attached ML2 has no issue displaying it at all.
Edit: I also printed out the world matrix of the offending object:
— | — | — | — |
---|---|---|---|
-1.00000 | 0.00000 | 0.00000 | -0.06836 |
0.00000 | 1.00000 | 0.00000 | 0.77463 |
0.00000 | 0.00000 | -1.00000 | 0.48522 |
0.00000 | 0.00000 | 0.00000 | 1.00000 |
I also did print that from object that has no issues:
— | — | — | — |
---|---|---|---|
-0.99175 | 0.07537 | 0.10372 | -0.09752 |
0.07038 | 0.99622 | -0.05101 | 0.04878 |
-0.10717 | -0.04329 | -0.99330 | 0.22585 |
0.00000 | 0.00000 | 0.00000 | 1.00000 |
Using:
- Unity 6000.49.f1
- ML2 OS 1.12.0
- Magic Leap SDK 2.6.0
- Magic Leap MRTK 1.4.0
- Host OS: Windows.