Unity Editor version: * 2022.3.53f1
ML2 OS version: 1.10.0
Unity SDK version: 2.5.0
Host OS: MacOS
XR Interaction Toolkit: 3.0.4
Hi!
I wanted to make a simple application that will just spawn object on the ar planes using XR Interaction toolkit. I used Unity AR Mobile template as a starting point. Mobile app works as intended, but Magic Leap app spawns objects under the plane. The reason is that in the mobile ar plane normal is (x, 1, z) for the plane on the floor (HorizontalUp plane alignment). While in the Magic Leap app ar plane normal is (x, -1, z) for the plane on the floor. But normal is incorrect for all plane types, not only those with arPlane.alignment == HorizontalUp. This is what I did and how one can reproduce it:
- Make Unity project 2022.3.53f1 from the AR Mobile template
- Build SampleScene to iPhone - everything is fine
- Import ML Setup tool and configure project for ML build
- Import ML Rig & OpenXR Input and Planes sample samples
- Copy SamplesScene to MLScene
- Move Object Spawner from XR Origin to scene root. Set SpawnObjectIndex to 6 (Debug Cube index)
- Replace XR Origin (AR Rig) with ML Rig prefab
- Remove status text from PlanesSample.cs and add it to scene
- Set ARInteractor in ARInteractorSpawnTrigger to Controller
- On ML Rig -> Camera Offset -> Controller -> Xr Ray Interactor enable “Enable AR Raycasting”
- Remove UI game object from scene
- Add Debug.Log("Spawn at plane " + arPlane.alignment + " with normal " + arPlane.normal); to ARInteractorSpawnTrigger.cs right before m_ObjectSpawner.TrySpawnObject(arRaycastHit.pose.position, arPlane.normal); call
- Build to device
- Spawn debug cube on trigger.
- Get "Spawn at plane HorizontalUp with normal (0.05, -1.00, 0.00)" debug message.
Screenshot from mobile:
Screenshot from ML2:
So basically the question is: am I doing something wrong or is it a bug?