Y and Z axis of RealityView coordinate space appear to be flipped in visionOS Simulator

Is this a know bug or is there a funamental misunderstanding on my part?

In the screenshot I've attached below I would expect the blue box to be perpendicular to the floor. It is the yAxisEntity in my code which I instatniate with a mesh of height 3. Instead it runs parallel to the floor what I'd expect to the z axis.

Here is my code

struct ImmerisveContentDebugView: View {
    
    @Environment(ViewModel.self) private var model
    
    @State var wallAnchor: AnchorEntity = {
        return AnchorEntity(.plane(.vertical, classification: .wall, minimumBounds: SIMD2<Float>(0.1, 0.1)))
    }()

    @State var originEntity: Entity = {
        let originMesh = MeshResource.generateSphere(radius: 0.2)
        return ModelEntity(mesh: originMesh, materials: [SimpleMaterial(color: .orange, isMetallic: false)])
    }()
    
    @State var xAxisEntity: Entity = {
        let line = MeshResource.generateBox(width: 3, height: 0.1, depth: 0.1)
        return ModelEntity(mesh: line, materials: [SimpleMaterial(color: .red, isMetallic: false)])
    }()
    
    @State var yAxisEntity: Entity = {
        let line = MeshResource.generateBox(width: 0.1, height: 3, depth: 0.1)
        return ModelEntity(mesh: line, materials: [SimpleMaterial(color: .blue, isMetallic: false)])
    }()
    
    @State var zAxisEntity: Entity = {
        let line = MeshResource.generateBox(width: 0.1, height: 0.1, depth: 3)
        return ModelEntity(mesh: line, materials: [SimpleMaterial(color: .green, isMetallic: false)])
    }()
    
    var body: some View {
        RealityView { content in
            content.add(wallAnchor)
            wallAnchor.addChild(originEntity)
            wallAnchor.addChild(xAxisEntity)
            wallAnchor.addChild(yAxisEntity)
            wallAnchor.addChild(zAxisEntity)
        }
    }
    
}

And here is what the simualtor renders

Answered by Todd2 in 760401022

I believe this is the expected behavior and consistent with RealityKit on the iPhone when attaching an anchor to a vertical surface.

Attached is an old RealityKit test I did, where I anchored the object to the wall. In this case, the green cube is along the +X axis, the red cube is the +Y axis, and the blue cube is the +Z axis.

If I recall correctly, when I attached things to the ceiling, the +Y axis pointed down. In general, I believe the +Y axis is the normal from the surface.

Accepted Answer

I believe this is the expected behavior and consistent with RealityKit on the iPhone when attaching an anchor to a vertical surface.

Attached is an old RealityKit test I did, where I anchored the object to the wall. In this case, the green cube is along the +X axis, the red cube is the +Y axis, and the blue cube is the +Z axis.

If I recall correctly, when I attached things to the ceiling, the +Y axis pointed down. In general, I believe the +Y axis is the normal from the surface.

Ah that makes sense thank you

Y and Z axis of RealityView coordinate space appear to be flipped in visionOS Simulator
 
 
Q