For the Vision Pro I want to create a mixed reality experience in Immersive Mode, however when I enter immersive mode in the Simulator, the background goes black when I want to continue seeing the living room (or whatever room someone is in). I notice in the ImmersiveView code it lists adding a skybox.
Does that mean ImmersiveView is VR or full visual takeover of the room, like with a skybox and not mixed reality, or I need to make changes? Thanks.
import SwiftUI import RealityKit import RealityKitContent
struct ImmersiveView: View { var body: some View { RealityView { content in // Add the initial RealityKit content if let immersiveContentEntity = try? await Entity(named: "Immersive", in: realityKitContentBundle) { content.add(immersiveContentEntity)
// Add an ImageBasedLight for the immersive content
guard let resource = try? await EnvironmentResource(named: "ImageBasedLight") else { return }
let iblComponent = ImageBasedLightComponent(source: .single(resource), intensityExponent: 0.25)
immersiveContentEntity.components.set(iblComponent)
immersiveContentEntity.components.set(ImageBasedLightReceiverComponent(imageBasedLight: immersiveContentEntity))
// Put skybox here. See example in World project available at
// https://developer.apple.com/
}
}
}
}
#Preview { ImmersiveView() .previewLayout(.sizeThatFits) }