Post

Replies

Boosts

Views

Activity

Trouble loading a reference object from Asset Catalog
Hi, I'm trying to test object recognition using ARKit. I scanned a couple of objects using the Apple demo app, copied the .arobject files to my laptop. I added them to my new project in Assets like shown in the image. However, as I follow the tutorial to load these objects to use as reference objects, I run into an error. let configuration = ARWorldTrackingConfiguration() guard let referenceObjects = ARReferenceObject.referenceObjects(inGroupNamed: "Test", bundle: Bundle.main) else { let ro = ARReferenceObject.referenceObjects(inGroupNamed: "Test", bundle: nil); let ro1 = ARReferenceObject.referenceObjects(inGroupNamed: "Gallery", bundle: .main); fatalError("Resource not found") } Here, we fail the guard statement and the ro and ro1 both are set to nil. I created a new project with just this one statement and that fails too. I'm using SwiftUI instead of UIKit if that makes a difference and am calling this in the makeUIView() function . Any pointers to what I might be doing wrong here are appreciated.
1
0
176
1w
How to handle having more than 10 WindowGroups and ImmersiveSpaces?
Hi, I'm building an app that has more than 10 Window Groups and Immersive Spaces. I ran into an issue where if I have more than 10, It won't compile with an error saying Extra arguments in call. Eg: WindowGroup(id: "Window 1"){ Debug() }.defaultSize(width: 1000, height: 800) ... ImmersiveSpace(id: "Space 11"){ Debug() }.immersionStyle(selection: .constant(.mixed), in: .mixed) I fixed it by grouping a bunch of window groups and was able to run my app, but soon realised that grouping does not work for Immersive Spaces because as soon as I opened an Immersive space from one of the groupings, It crashes citing an error from SceneManifest. It thinks the app boots up to an Immersive Space. It looks like this: Group { WindowGroup(id: "Window 1"){ Debug() }.defaultSize(width: 1000, height: 800) ... WindowGroup(id: "Window 11"){ Debug() }.defaultSize(width: 1000, height: 800) } Group { ImmersiveSpace(id: "Space 1"){ IMView() }.immersionStyle(selection: .constant(.mixed), in: .mixed) } .... ImmersiveSpace(id: "Space 11"){ IMView() }.immersionStyle(selection: .constant(.mixed), in: .mixed) } SwiftUI/UIKitAppDelegate.swift:770: Fatal error: Your app was given a scene with session role UISceneSessionRole(_rawValue: UISceneSessionRoleImmersiveSpaceApplication) but no scenes declared in your App body match this role. I can fix this by removing the groupings and having them be if I reduce the amount of views and windows. Is there a way to overcome this limitation?
2
0
318
Feb ’24
Changing the animations when transitioning from mixed immersive to full immersive mode.
Hi, I'm building an app where I want to transition from mixed reality immersive mode to full immersive mode when a user taps on a portal. Right now, what I have is this: When a user taps a portal, I will expand the portal mesh to show more of the world for 2 seconds. I then remove the world component from the world the portal is showing to place the world in the mixed immersive space. I remove the portal object from the scene. I then change the immersive mode of the ImmersiveView from mixed to full. However, the last step will cause Vision OS to play an animation that fades to black and eases in the scene from the center. Is there any way I can control this animation or is there an easier way to use portals to go into a fully immersive scene? I feel like portal component is built specifically for this but it doesn't have the functionality to click right now.
0
2
205
Oct ’23