I still couldn't get shadows working for usdz models, but grounding shadow does work for procedural meshes generated using code like the following:
let sphereEntity = ModelEntity(mesh: MeshResource.generateSphere(radius: 0.05), materials: [SimpleMaterial(color: .blue, roughness: 0, isMetallic: true)])
sphereEntity.setPosition([0, 0.1, 0], relativeTo: root)
sphereEntity.components.set(GroundingShadowComponent(castsShadow: true))
sphereEntity.components.set(TraceComponent(anchor: root, width: 1))
Post
Replies
Boosts
Views
Activity
The documentation is particularly bad about RealityView. There is no clear guidance on what you should do in the make/update/attachment closure, the order in which these closures are executed, etc.
Based on my experience - you can't expect change to environment objects to trigger the update closure. This is REALLY SURPRISING. My workaround is to use another view that wraps the reality view and listens to that environment object, which also passes the listened object as a prop to the reality view. In a reality view, any change in @State or a prop should trigger the update closure.
The update closure is also called multiple times at the beginning of the lifecycle, which I have no idea why. That was not documented anywhere. When does the entities in the attachment closure become visible to the other closures? Also no clue.
If someone from Apple is reading - this RealityView is the single most important concept introduced in RealityKit2. It's the entrance to everything and really worth more documentation and more examples.
I got the same thing.
I solved it by clicking on the open button which gives you a file picker, and then click on the open button in the file picker again. Do it for every error.
This is the biggest confusion caused by documentation right now.
You can achieve what ZeTof is showing in VisionOS by using RealityKit's attachment closure to position SwiftUI views in 3D. See a demo here: https://twitter.com/tracy__henry/status/1680811420903165953
Can I get a response on this one? really wanted to get grounding shadow to work.
I followed everything in this video but nothing worked: https://developer.apple.com/videos/play/wwdc2023/10095
If I understand correctly, you can't position windows.
But you can use RealityKit's attachments closure to do what you want. See this video and this demo: https://twitter.com/tracy__henry/status/1680811420903165953
+1
would love a response from the vision os team.