Post

Replies

Boosts

Views

Activity

Reply to What is the first reliable position of the apple vision pro device?
By the way, thank you for your recommendations to use AnchorEntity(.head). We have tried using it before but kept getting inconsistencies wrt entity placements and re-adjustments, We are still trying to figure out how best to use it. Adding all our content has AnchorEntity(.head)'s children is requiring lots of refactoring, since we have several entities controlled by Timeline animations, and as mentioned, we are not getting correct head positioning. Currently, our favorite best working solution for eye-level placement is the DeviceTracker shared above.
Topic: Spatial Computing SubTopic: ARKit Tags:
May ’25
Reply to What is the first reliable position of the apple vision pro device?
Hi Vision Pro Engineer, Thanks for your reply, and apologies for my late reply. We tried points 1, 2, and 3 of your recommendations and have since moved our logic into the following DeviceTracker class. Using your recommendations, we appear to be able to remove the frame counter properties. But, the following arbitrary yValue > 0.3 condition needs to remain. Otherwise, we are still getting negative values, see image. import ARKit import Combine import OSLog import RealityKit import SwiftUI @Observable public final class DeviceTracker { private let session = ARKitSession() private let worldInfo = WorldTrackingProvider() private var sceneUpdateSubscription: EventSubscription? private let logger = Logger(subsystem: SUBSYSTEM, category: "DeviceTransformTracker") public var deviceTransform: simd_float4x4? = nil public init() { // Defer the task until self is fully initialized Task.detached(priority: .userInitiated) { [session, worldInfo, logger] in do { try await session.run([worldInfo]) } catch { logger.error("\(#function) \(#line) Failed to start ARKitSession: \(error.localizedDescription)") } } } public func subscribe(content: RealityViewContent) { sceneUpdateSubscription = content.subscribe(to: SceneEvents.Update.self) { [weak self] _ in guard let self = self else { return } guard self.worldInfo.state == .running else { logger.warning("\(#function) \(#line) worldInfo.state not running") return } guard let deviceAnchor = self.worldInfo.queryDeviceAnchor(atTimestamp: CACurrentMediaTime()) else { logger.warning("\(#function) \(#line) missing deviceAnchor for CACurrentMediaTime() \(String(describing: CACurrentMediaTime()))") return } guard deviceAnchor.isTracked else { logger.warning("\(#function) \(#line) deviceAnchor not yet tracked") return } let yValue = deviceAnchor.originFromAnchorTransform.columns.3.y logger.warning("\(#function) \(#line) y value = \(deviceAnchor.originFromAnchorTransform.columns.3.y)") if yValue > 0.3 { self.deviceTransform = deviceAnchor.originFromAnchorTransform } } } public func cancel() { sceneUpdateSubscription?.cancel() } }
Topic: Spatial Computing SubTopic: ARKit Tags:
May ’25
Reply to Video Memory Leak when Backgrounding
The above makes sense. We solved our memory leak by not using a model isolating our video feature to a RealityView who job it is to only show video (in our case in 180 degree sphere) taking in the appropriate URL. So, the RealityView itself has all the AVFoundation objects and logic to play and display video. When we navigate to and away from the view, the RealityView is either recreated our destroyed, we actually observe the memory created and released. We are no longer using a notification though, we take note of the weak reference for when we'll add additional features to video playback.
Topic: Spatial Computing SubTopic: General Tags:
Oct ’24
Reply to Window to Window container displacement
Hello, As of visionOS 2.0 the prompt is not longer as pronounced. See this tread for more information. Ok, we removed the alert, thanks for informing. change Preferred Default Scene Session Role to Immersive Space Application Session Role in your info.plist Thanks you, this also worked. FYI, pushWindow did work to resolve the vertical displacement. But, we encountered a new error with it.. It seems like there is a limit to the amount of windows we can push. I was hopeful with this pushWindow we could create view hierarchies, but we appear to be limited to two levels... So, now the new issue is: The application failed to create new scene, scene limit exceeded.. Sorry for the piling of issues, ie: regional issue, it's resolution, and now encountering new issue.. Thanks you for your help.
Topic: Spatial Computing SubTopic: General Tags:
Sep ’24
Reply to Window to Window container displacement
Hello, Thank you for your response. I want to confirm you are aware that visionOS presents people with a similar warning by default, before they enter a fully immersive space. Does this warning only appear in the physical device? Creating a simple test project with the below configuration does not display this alert in the simulator. How can I be certain the alert will display on the physical device, when it does not in the simulator upon pressing Show Immersive Space of the template project? it's not currently possible to open a window directly over another window without creating a NavigationStack behind the scenes. That is not what we are trying to achieve. Our designers would like to have the alert as the very first view, and then go directly into the ImmersiveSpace. We do not want to display any other view or volume as an initial scene. When we chose our configuration for the project template, in Initial Scene it appears we cannot set ImmersiveSpace as an initial scene. I looks like we have no other choice but to display a view prior to displaying an immersive space. a) Is this correct? b) Or, is it indeed possible for an ImmersiveSpace to be the initial scene of our app? Thank you for the other information you provided.
Topic: Spatial Computing SubTopic: General Tags:
Sep ’24