realitykit

How do I save and load ARWorldMap in SwiftUI app?

岁酱吖の 提交于 2021-02-19 05:38:26
问题 I followed a YouTube tutorial on how to place virtual Models in SwiftUI. Now that I can place my Models, I would like to save and load the models position. I have already made 2 Buttons for save and load, but I don't know the correct code to save and load the Entities and Anchors. The following code is inside my updateUIView function: func updateUIView(_ uiView: ARView, context: Context) { if let name = self.modelName { print("Modell mit dem Namen \(name) wurde zum plaziert") let filename =

Implement a crosshair kind behaviour in RealityKit

我们两清 提交于 2021-02-10 17:45:50
问题 What I want to achieve: Attach a sphere to the camera position (so that it always stay at the center of the screen as the device move) and detect when it is on top of other AR objects - to trigger other actions/behaviour on the AR objects. Approach: I have created the sphere and attached to the center of the screen as shown below @IBOutlet var arView: ARView! override func viewDidLoad() { super.viewDidLoad() let mesh = MeshResource.generateSphere(radius: 0.1) let sphere = ModelEntity(mesh:

Apple framework not found when building Archive

爱⌒轻易说出口 提交于 2021-02-05 10:45:11
问题 I'm trying to add optional support for an AR feature to an existing app using RealityKit. The app builds and runs fine on both iOS 10 and iOS 13 devices with the optional feature only enabled in the latter. However, when I build for a Generic iOS Device or try to Archive, I get an error No such module 'RealityKit' on any import RealityKit statement and the build fails. The build target for the app is iOS 10, with RealityKit being available in iOS 13. I've added guards to only build certain

how to re-render the scanned mesh content with realityKit's ARView?

只谈情不闲聊 提交于 2021-01-28 07:51:38
问题 I can modify the line color of the mesh using the following code. extension ARMeshClassification { var description: String { switch self { case .ceiling: return "Ceiling" case .door: return "Door" case .floor: return "Floor" case .seat: return "Seat" case .table: return "Table" case .wall: return "Wall" case .window: return "Window" case .none: return "None" @unknown default: return "Unknown" } } var color: UIColor { switch self { case .ceiling: return .red case .door: return .green case

Using ARKit anchor to place RealityKit Scene

為{幸葍}努か 提交于 2021-01-05 11:23:32
问题 I am currently struggling to add an RealityKit Scene to an ARKit anchor. As my previous question, it is not possible to directly add the RealityKit Scene to an ARKit Anchor Node. But how can I use the ARKit Anchor to place my Scene? For example, I want to find an object in the room, and depending on which object I found, I want to use different scenes and anchor them in the room depending on the recognised objects position. Thanks for the help. Current try: func makeUIView(context: Context) -