Post

Replies

Boosts

Views

Activity

Reply to Update World Anchor using object anchor
Thank you for the answer and for the great guidance. Great that it is possible, and that it will be easy to implement in Reality Composer pro, once it is set up. I managed to create the Component in Reality Composer Pro, and added the code to ObjectToWorldComponent in Xcode I run in to some problems after that. in NameApp I added the lines from your description, but I het to errors of "Cannot find 'ObjectToWorldComponent' in scope" and "Cannot find 'ObjectToWorldSystem' in scope" Here is the code: import SwiftUI @main struct ankerApp: App { @State private var appModel = AppModel() //Kode fra forum som flytter object anker til World Anker init() { ObjectToWorldComponent.registerComponent() ObjectToWorldSystem.registerSystem() } var body: some Scene { WindowGroup { ContentView() .environment(appModel) } .windowStyle(.volumetric) ImmersiveSpace(id: appModel.immersiveSpaceID) { ImmersiveView() .environment(appModel) .onAppear { appModel.immersiveSpaceState = .open } .onDisappear { appModel.immersiveSpaceState = .closed } } .immersionStyle(selection: .constant(.mixed), in: .mixed) } } And in ImmersiveView I get an error saying: "Result of call to 'run' is unused" That is next to the "await spatialTrackingSession.run(configuration)" line. Here is the code: import RealityKit import RealityKitContent struct ImmersiveView: View { let spatialTrackingSession = SpatialTrackingSession() var body: some View { RealityView { content in if let immersiveContentEntity = try? await Entity(named: "Immersive", in: realityKitContentBundle) { content.add(immersiveContentEntity) } } .task { // Start a spatial tracking session to obtain permission to query the object and world anchor transforms. let configuration = SpatialTrackingSession.Configuration( tracking: [.object, .world]) await spatialTrackingSession.run(configuration) } } } #Preview(immersionStyle: .mixed) { ImmersiveView() .environment(AppModel()) } I really hope to get some help with the last few issues. Bedst regards.
Aug ’24
Reply to Update World Anchor using object anchor
Arh, I put the system code in the ObjectToWorldComponent. I am not sure where that code goes. Do I make a new file from template (VisionOS Swift file) and put the code in there; and I that case does it go in the "top" of my project with the immersiveView and ProjectApp files, or should it go in RealityKitContent next to the ObjectToWorldComponent? Would it be possible for you to make an empty vision app with just these components to help me understand where everything goes? Thank you for the help and patience.
Aug ’24
Reply to Open Reality Composer pro Scenes as were they files
The Scene is displayed as a mixed immersive space. Once it is loaded, there are s couple of things going on. I have some items that I can look at and tap to adjust the height of items in the scene. These are made with actions in a timeline inside Reality Composer pro. Also there is a custom component used with object tracking. It moves the object anchor to a world anchor, and updates that only if the object is moved. For now I don't think I am using any of the build in Components, but I would like to be able to down the line. I hope this gives the clarification you need. And thank you for helping out.
Sep ’24