Thanks maxxfrazer,
Actually I'm using SwiftUI. I tried to set the cube position as [0,0,-1]. See below.
struct ContentView : View {
var body: some View {
return ARViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
arView.cameraMode = .nonAR
let boxAnchor = try! Experience.loadBox()
arView.scene.anchors.append(boxAnchor)
boxAnchor.setPosition([0,0,-1], relativeTo: nil)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}
I also tried to use the other initializer for the ARView. See below.
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let frameRect = CGRect(x: 0, y: 0, width: 100, height: 100)
let cameraMode = ARView.CameraMode.nonAR
let arView = ARView(frame: frameRect, cameraMode: cameraMode, automaticallyConfigureSession: false)
let boxAnchor = try! Experience.loadBox()
arView.scene.anchors.append(boxAnchor)
boxAnchor.setPosition([0,0,-1], relativeTo: nil)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}
...but that did not help either (I'm not sure how to use the "frame"). Any ideas?