1

I'm running in a problem while trying to add gestures to an imported USDZ file in RealityKit, the model is correctly loaded but I receive this error:

// Thread 1: Swift runtime failure: type cast failed

The code is:

do {
    let entity = try ModelEntity.load(named: "scan")
    newAnchor.addChild(entity)
    entity.generateCollisionShapes(recursive: true)
    uiView.installGestures(.translation, for: entity as! Entity & HasCollision)
    uiView.scene.anchors.append(newAnchor)
} catch {
    print("file not found 2")
}

Note that the USDZ file come from RoomPlan API scan.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220

0 Answers0