Discuss spatial computing on Apple platforms and how to design and build an entirely new universe of apps and games for Apple Vision Pro.

All subtopics

Post

Replies

Boosts

Views

Activity

VisionOS App Runs Poorly And Crashes First Time It Launches
Here's a video clearly demonstrating the problem: https://youtu.be/-IbyaaIzh0I This is a major issue for my game, because it's not meant to be played multiple times. My game is designed to only play once, so it really ruins the experience if it runs poorly until someone force quits or crashes the game. Does anyone have a solution to this, or has encountered this issue of poor initial launch performance? I made this game in Unity and I'm not sure if this is an Apple issue or a Unity issue.
0
1
260
Aug ’24
Retrieve AnchorEntity (Hand Locations) Position through update(context: Scene) function
Hello there, I'm currently working on a Hand Tracking System. I've already placed some spheres on some joint points on the left and right hand. Now I want to access the translation/position value of these entities in the update(context: Scene) function. Now my question is, is it possible to access them via .handAnchors(), or which types of .handSkeleton.joint(name) are referencing the same entity? (E.g. is AnchorEntity(.hand(.right, location: .indexFingerTip)) the same as handSkeleton.joint(.indexFingerTip). The goal would be to access the translation of the joints where a sphere has been placed per hand and to be able to update the data every frame through the update(context) function. I would very much appreciate any help! See code example down below: ImmersiveView.swift import SwiftUI import RealityKit import ARKit struct ImmersiveView: View { public var body: some View { RealityView { content in /* HEAD */ let headEntity = AnchorEntity(.head) content.add(headEntity) /* LEFT HAND */ let leftHandWristEntity = AnchorEntity(.hand(.left, location: .wrist)) let leftHandIndexFingerEntity = AnchorEntity(.hand(.left, location: .indexFingerTip)) let leftHandWristSphere = ModelEntity(mesh: .generateSphere(radius: 0.02), materials: [SimpleMaterial(color: .red, isMetallic: false)]) let leftHandIndexFingerSphere = ModelEntity(mesh: .generateSphere(radius: 0.01), materials: [SimpleMaterial(color: .orange, isMetallic: false)]) leftHandWristEntity.addChild(leftHandWristSphere) content.add(leftHandWristEntity) leftHandIndexFingerEntity.addChild(leftHandIndexFingerSphere) content.add(leftHandIndexFingerEntity) } } } TrackingSystem.swift import SwiftUI import simd import ARKit import RealityKit public class TrackingSystem: System { static let query = EntityQuery(where: .has(AnchoringComponent.self)) private let arKitSession = ARKitSession() private let worldTrackingProvider = WorldTrackingProvider() private let handTrackingProvider = HandTrackingProvider() public required init(scene: RealityKit.Scene) { setUpSession() } private func setUpSession() { Task { do { try await arKitSession.run([worldTrackingProvider, handTrackingProvider]) } catch { print("Error: \(error)") } } } public func update(context: SceneUpdateContext) { guard worldTrackingProvider.state == .running && handTrackingProvider.state == .running else { return } let _ = context.entities(matching: Self.query, updatingSystemWhen: .rendering) if let avp = worldTrackingProvider.queryDeviceAnchor(atTimestamp: currentTime) { let hands = handTrackingProvider.handAnchors(at: currentTime) ... } } }
2
0
314
Aug ’24
Location of tap gesture in VisionOS
Is it possible to get the location of where a user uses the tap gesture on the screen? Like an x/y coordinate that can be used within my app. I know there is spatialTapGesture but from what I can tell that is only linked to content entities like a cube or something. Does this mean I can only get the x/y coordinate data by opening an immersive space and using the tap gesture in relation to some entity? TLDR: Can I get the location of a tap gesture in Vision OS in a regular app, without opening an immersive space?
0
0
197
Aug ’24
Material Reference from Reality Composer Pro
I have a model entity (from Reality Composer Pro) I want to change the material of the model entity inside swift. The material is also imported in reality composer pro. I am copying the USDZ file of the material in the same directory as the script. This is the code I am using to reference the Material. do { // Load the file data if let materialURL = Bundle.main.url(forResource: "BlackABSPlastic", withExtension: "usdz") { let materialData = try Data(contentsOf: materialURL) // Check the first few bytes of the data to see if it matches expected types let headerBytes = materialData.prefix(4) let headerString = String(decoding: headerBytes, as: UTF8.self) // Print out the header information for debugging print("File header: \(headerString)") // Attempt to load the ShaderGraphMaterial let ScratchedMetallicPaint = try await ShaderGraphMaterial( named: "BlackABSPlastic", from: materialData ) print(ScratchedMetallicPaint) } else { print("BlackABSPlastic.usdz file not found.") } } catch { // Catch the error and print it print("BlackABSPlastic load failed: \(error)") // Attempt to infer file type based on the error or file content if let error = error as? DecodingError { switch error { case .typeMismatch(let type, _): print("Type mismatch: Expected \(type)") case .dataCorrupted(let context): print("Data corrupted: \(context.debugDescription)") default: print("Decoding error: \(error)") } } else { print("Unexpected error: \(error)") } } I am receiving these errors: File header: PK TBB Global TLS count is not == 1, instead it is: 2 Unable to create stage from in-memory buffer. BlackABSPlastic load failed: internalImportError Unexpected error: internalImportError am I doing anything wrong? I am able to access the materials of the model entity easily but this seems to something different. How can this be resolved? Thanks.
1
0
320
Aug ’24
visionOS – Anchoring particle system to hand also anchors spawned particles
Dear Apple Developer Forums, I am just starting out developing in Swift, using RealityKit and Reality Composer Pro, as a project I'm working on is transitioning from using Unity to native only. I am trying to attach a particle system to the user's right hand, emitting from a single point, showing a 'spatial trail' of sorts, basically acting as a visualizer of the hand's spatial history. However, in Reality Composer Pro, when I anchor my particle emitter's parent entity using an Anchor component, even though the "Particles Inherit Transform" option is unticked (false), all of the spawned particles will also be anchored to the specified anchor position, as opposed to the expected behavior, which is that the emitter itself is anchored, but the spawned particles retain their spawn position in worldspace. Am I missing something, or does anchoring simply behave this way in relation to particle systems? Thank you! RCP 1.0, Xcode 15.4, visionOS 1.2
1
0
320
Aug ’24
Weird error about EnvironmentResource
func createEnvironmentResource(image:UIImage) -> EnvironmentResource? { do { let cube = try TextureResource( cubeFromEquirectangular: image.cgImage!, quality: .normal, options: TextureResource.CreateOptions(semantic: .hdrColor) ) let environment = try EnvironmentResource( cube: cube, options: EnvironmentResource.CreateOptions( samplingQuality: .normal, specularCubeDimension: cube.width/2 // compression: .astc(blockSize: .block4x4, quality: .high) ) ) return environment }catch{ print("error: \(error)") } return nil } When I put this code in the project, it can run normally on the visionOS 2.0 simulator. When it is run on the real machine, an error is reported at startup: dyld[987]: Symbol not found: _$s10RealityKit19EnvironmentResourceC4cube7optionsAcA07TextureD0C_AC0A10FoundationE13CreateOptionsVtKcfC Referenced from: <DEC8652C-109C-3B32-BE6B-FE634EC0D6D5> /private/var/containers/Bundle/Application/CD2FAAE0-415A-4534-9700-37D325DFA845/HomePreviewDEV.app/HomePreviewDEV.debug.dylib Expected in: <403FB960-8688-34E4-824C-26E21A7F18BC> /System/Library/Frameworks/RealityFoundation.framework/RealityFoundation What is the reason and how to solve it ?
1
0
279
Aug ’24
Creating tabletop games - Build Failure
The sample code project Tabletopkit Sample found at the article Creating tabletop games here fails to compile with the following errors in Xcode 16 beta 6. error: [xrsimulator] Component Compatibility: Billboard not available for 'xros 1.0', please update 'platforms' array in Package.swift error: [xrsimulator] Exception thrown during compile: compileFailedBecause(reason: "compatibility faults") error: Tool exited with code 1
3
0
376
Aug ’24
Compose interactive 3D content in Reality Composer Pro -- Build Error
Compilation of the project for the WWDC 2024 session title Compose interactive 3D content in Reality Composer Pro fails. After applying the fix mentioned here (https://developer.apple.com/forums/thread/762030?login=true), the project still won't compile. Using Xcode 16 beta 7, I get these errors: error: [xrsimulator] Component Compatibility: EnvironmentLightingConfiguration not available for 'xros 1.0', please update 'platforms' array in Package.swift error: [xrsimulator] Component Compatibility: AudioLibrary not available for 'xros 1.0', please update 'platforms' array in Package.swift error: [xrsimulator] Component Compatibility: BlendShapeWeights not available for 'xros 1.0', please update 'platforms' array in Package.swift error: [xrsimulator] Exception thrown during compile: compileFailedBecause(reason: "compatibility faults") error: Tool exited with code 1
3
0
342
Aug ’24
SafariWebView in ImmersiveSpace with hand tracking
Is it possible to show a SafariWebView in an ImmersiveSpace with hand tracking enabled? I have an app with an initialView that launches an immersive space and opens a SafariView. I noticed that hand tracking stops working when I open the SafariView, but not when I open the TestView (which is just an empty window). Here's the Scene: var body: some Scene { WindowGroup(id: "control") { InitialView() }.windowResizability(.contentSize) WindowGroup(id: "test") { TestView() }.windowResizability(.contentSize) WindowGroup(id: "safari") { SafariView(url: URL(string: "some URL")!) } ImmersiveSpace(id: "immersiveSpace") { ImmersiveView() } }
1
0
186
Aug ’24
Difficulty Locating Center of Pupil Using ARKit – Vision vs. ARKit for Fine Detail?
Hi everyone, I'm working on an AR application where I need to accurately locate the center of the pupil and measure anatomical distances between the pupil and eyelids. I’ve been using ARKit’s face tracking, but I’m having trouble pinpointing the exact center of the pupil. My Questions: Locating Pupil Center in ARKit: Is there a reliable way to detect the exact center of the pupil using ARKit? If so, how can I achieve this? Framework Recommendation: Given the need for fine detail in measurements, would ARKit be sufficient, or would it be better to use the Vision framework for more accurate 2D facial landmark detection? Alternatively, would a hybrid approach, combining Vision for precision and ARKit for 3D tracking, be more effective? What I've Tried: Using ARKit’s ARFaceAnchor to detect face landmarks, but the results for the pupil position seem imprecise for my needs. Considering Vision for 2D detection, but concerned about integrating it into a 3D AR experience. Any insights, code snippets, or guidance would be greatly appreciated! Thanks in advance!
0
1
235
Aug ’24
Inquiry About the Precision of Apple Vision Pro LiDAR
Hello everyone, I am a developer working on the Apple Vision Pro platform, currently developing an application that relies heavily on the Vision Pro LiDAR sensor. To ensure the accuracy and performance of my application, I would like to gather more detailed information about the technical specifications of the LiDAR sensor, particularly in the following areas: 1. Distance Accuracy: How accurate is the LiDAR sensor at different distances? 2. Spatial Resolution: What is the smallest object size that the sensor can detect? 3. Environmental Impact: How does the performance of the LiDAR sensor vary under different lighting conditions or environmental factors (e.g., reflective surfaces, fog)? I would greatly appreciate any detailed information or technical documentation regarding these questions. If there are any developers or Apple staff members who have insights on this, your input would be highly valued. Thank you in advance for your assistance!
1
0
245
Aug ’24
how to hide window in vision pro?
when I use openwindow to show a volume window,I want to hide the old window ,keep it stays where it is, when I close the volume window, the old window appears again.the logic is simple, I tried to use opaque to hide the old window, but the window bar is still there, which is very annoying. how could I solve this?
2
1
227
Aug ’24
ARView -> iOS 18.0 (22A5338b)
Hello, Im not able to get any 3d object visible in ARView. struct ARViewContainer: UIViewRepresentable { var trackingState: ARCamera.TrackingState? = nil func makeUIView(context: Context) -> ARView { // Create the view. let view = ARView(frame: .zero) // Set the coordinator as the session delegate. view.session.delegate = context.coordinator let anchor = AnchorEntity(plane: .horizontal) let box = ModelEntity(mesh: MeshResource.generateBox(size: 0.3), materials: [SimpleMaterial(color: .red, isMetallic: true)]) box.generateCollisionShapes(recursive: true) anchor.addChild(box) view.scene.addAnchor(anchor) // Return the view. return view } final class Coordinator: NSObject, ARSessionDelegate { var parent: ARViewContainer init(_ parent: ARViewContainer) { self.parent = parent } func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) { print("Camera tracking state: \(camera.trackingState)") parent.trackingState = camera.trackingState } } func makeCoordinator() -> Coordinator { Coordinator(self) } func updateUIView(_ uiView: ARView, context: Context) { } } View is loaded correctly but anything cant appear. I also tried to create 3D object in func updateUIView(_ uiView: ARView, context: Context) { let anchor = AnchorEntity(plane: .horizontal) let box = ModelEntity(mesh: MeshResource.generateBox(size: 0.3), materials: [SimpleMaterial(color: .red, isMetallic: true)]) box.generateCollisionShapes(recursive: true) anchor.addChild(box) uiView.scene.addAnchor(anchor) print("Added into the view") } Print statement is printed but there is still no object in the ARView. Is it bug or what am I missing?
1
0
290
Aug ’24
Cinema 4D to Reality Composer Pro
Hello Dev team, 3 weeks I'm looking for how I can export a static Cinema 4D objects WITH TEXTURES to Reality Composer Pro ! I can export it directly on USDA format and it works well for the 3D model in Reality Composer Pro, BUT, I can't have the textures on my model. My model is simple not colored ! Of course I expect to have textures applied on the good place and same appearance I've in Cinema 4D. Could you give me a process to do that please ? I'm using Cinema 4D R25 and Last XCode and Reality Composer Pro beta versions. Big big thanks to the one could help me on this. It will unblock many things to me!!!! Cheers Mathis
1
0
284
Aug ’24