I am using the Xcode visionOS debugging tool to visualize the bounds of all the containers, but it shows my Entity is inside the Volume. Then why does it get clipped? Is there something wrong with the debugger, or am I missing something?
import SwiftUI
@main
struct RealityViewAttachmentApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.windowStyle(.volumetric)
.defaultSize(Size3D(width: 1, height: 1, depth: 1), in: .meters)
}
}
import SwiftUI
import RealityKit
import RealityKitContent
struct ContentView: View {
var body: some View {
RealityView { content, attachments in
if let earth = try? await Entity(named: "Scene", in: realityKitContentBundle) {
content.add(earth)
if let earthAttachment = attachments.entity(for: "earth_label") {
earthAttachment.position = [0, -0.15, 0]
earth.addChild(earthAttachment)
}
if let textAttachment = attachments.entity(for: "text_label") {
textAttachment.position = [-0.5, 0, 0]
earth.addChild(textAttachment)
}
}
} attachments: {
Attachment(id: "earth_label") {
Text("Earth")
}
Attachment(id: "text_label") {
VStack {
Text("This is just an example")
.font(.title)
.padding(.bottom, 20)
Text("This is just some random content")
.font(.caption)
}
.frame(minWidth: 100, maxWidth: 300, minHeight: 100, maxHeight: 300)
.glassBackgroundEffect()
}
}
}
}