// scale model to 50%
entity.scale = .init(repeating: 0.5)
Post
Replies
Boosts
Views
Activity
In your main view you can use SwiftUI to add buttons to allow the user to tap and change the current material. You can set that selected material onto a ViewModel object, or have the button actions trigger a function on the ViewModel. Present an ImmersiveSpace and use the same ViewModel object over there. Add your desired ModelEntity to the RealityView of the ImmersiveSpace. Make a reference to that ModelEntity in your ViewModel. Back in your SwiftUI View and ViewModel, make your button actions modify the .material of the ModelEntity previously added. Now, you have a SwiftUI view with button actions hooked up to the same ViewModel that has a reference to the ModelEntity.
Model3D("filename")
WindowGroup {
..........
}.defaultSize(CGSize(width: 700, height: 700))
From my understanding you want to still see the room while an Immersive Space space is active? For that, you can simply set the immersionStyle selection to .mixed, from where you register the ImmersiveSpace in your @main app body.
Here's an example I have:
ImmersiveSpace(id: "ImmersiveView") { ImmersiveView(viewModel: viewModel) }.immersionStyle(selection: .constant(.mixed), in: .mixed)
https://developer.apple.com/documentation/swiftui/immersionstyle
Is it possible to use animations from one model to play on a different model with same skeleton? I know this is possible in SceneKit AR implementation, but I am having a lot of problems doing this in RealityKit. Thanks for any advice.
I am working on an application that uses RealityKit and AVAudioSession for audio calls, and I too am having the same owningEngine == nil crash. It has been a nightmare for a few months now...
I think this project in particular was not done natively - it was done in Unity.