Hey guys
How I can fit RealityView content inside a volumetric window?
I have below simple example:
WindowGroup(id: "preview") {
RealityView { content in
if let entity = try? await Entity(named: "name") {
content.add(entity)
entity.setPosition(.zero, relativeTo: entity.parent)
}
}
}
.defaultSize(width: 0.6, height: 0.6, depth: 0.6, in: .meters)
.windowStyle(.volumetric)
I understand that we can resize a Model3D view automatically using .resizable() and .scaledToFit() after the model loaded.
Can we achieve the same result using a RealityView?
Cheers
Post
Replies
Boosts
Views
Activity
I have a RealityView and I want to add an Entity with an Attachment.
Assuming I have a viewModel manage my entities, and the addEntityGesture() will add a new Entity under the rootEntity.
RealityView { content, attachments in
// Load initial content
content.add(viewModel.rootEntity)
} update: { updateContent, updateAttachments in
//
} attachments: {
//
}
.gesture(addEntityGesture())
I know that we can create attachment in the attachments closure, and add those attachments as entities in our make closure, however, what if I want to add entity with an attachment on the fly?