只有 arView.scene.anchors 中第一个锚点的手势有效

问题描述 投票:0回答:0

我在 .rcproject 文件中有 2 个场景,每个场景都是图像锚点类型。我想添加手势以与 3D 模型(potteryAnchor.pot1 和 potteryNormalImageAnchor.pot1NormalImage)交互。但是,只有 potteryAnchor.pot1 的手势有效。下面是我的代码

potteryAnchor = try! Pottery.load_Pottery()
potteryNormalImageAnchor = try! Pottery.loadPottery1NormalImage()
arView.scene.anchors.append(potteryAnchor!)
arView.scene.anchors.append(potteryNormalImageAnchor!)
        
potteryAnchor?.pot1?.generateCollisionShapes(recursive: true)
arView.installGestures([.rotation, .scale, .translation], for: (potteryAnchor?.pot1 as? Entity & HasCollision)!)

potteryNormalImageAnchor?.pot1NormalImage?.generateCollisionShapes(recursive: true)
arView.installGestures([.rotation, .scale, .translation], for: (potteryNormalImageAnchor?.pot1NormalImage as? Entity & HasCollision)!)

我注意到如果我交换 2 行 3 和 4 的位置,结果将相反。

我怎样才能实现我的目标。谢谢

swift arkit realitykit
© www.soinside.com 2019 - 2024. All rights reserved.