So I asked a different question before, and arrived at a partial solution. I was able to add gestures to ONE of the two model entities on one scene, but not the other. Because when you print the scene, the two models have the same root name, but only the first one gets the gestures.
See the two cubes here, I was able to drag the blue cube to the front, but nothing happens when I try to drag the green cube
import UIKit
import RealityKit
import SwiftUI
class ViewController: UIViewController {
@IBOutlet var arView: ARView!
//private var myEntity: Entity?
typealias GstReady = Entity & HasCollision
//typealias ModelPack = ModelEntity & HasCollision
override func viewDidLoad() {
super.viewDidLoad()
let boxAnchor = try! Experience.loadBox()
arView.scene.anchors.append(boxAnchor)
let cubesAnchor = try! Experience.loadCubes()
arView.scene.anchors.append(cubesAnchor)
if let entity = cubesAnchor.findEntity(named: "simpBld_root") as? GstReady {
entity.generateCollisionShapes(recursive: false)
arView.installGestures([.all], for: entity)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0){
//self.arView.scene.anchors.removeAll()
let coneAnchor = try! Experience.loadCone()
self.arView.scene.anchors.append(coneAnchor)
print(cubesAnchor)
}
func handleTapOnEntity(_ entity: Entity?){
guard let entity = entity else { return }
//self.myEntity = entity
//self.myEntity?.isEnabled = false
}
}
}
See related question here