RealityView fit in volumetric window

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

Yes, its possible to just scale it like: RealityView { content in if let entity = try? await Entity(named: "name") { entity.scale = .init(repeating: 0.01) <- set whatever makes sense, its CGFloat and 1.0 would be 100% of the model size. content.add(entity) entity.setPosition(.zero, relativeTo: entity.parent) } }

This is one reason why i should open this in immersive space instead, but if you still want it in a volume, thats one way to do it.

RealityView fit in volumetric window
 
 
Q