Yes you can. I managed to do it using a regular attachments.
But be aware that the attachment API has changed from the original documentation:
https://forums.developer.apple.com/forums/thread/736588
So in my RealityView that is my immersive space i add after content.add:
// Portal is created 2m from you with root of immersive space being where the user stands.
if let portalCenterAttachment = attachments.entity(for: "portal_center"){
portalCenterAttachment.position = [0, 1.25, -2]
immersiveContentEntity.addChild(portalCenterAttachment)
And then after closing your RealityView you need to create the attachment using this new syntax:
attachments: {
Attachment(id: "portal_center") {
MyPortalView()
}
MyPortalView() is your RealityView with the makeWorld() and makePortal() in it.
I think that all still works as descibed in: https://developer.apple.com/videos/play/wwdc2023/10081
Topic:
Graphics & Games
SubTopic:
RealityKit
Tags: