Contents

volumeWorldAlignment(_:)

Specifies how a volume should be aligned when moved in the world.

Declaration

nonisolated func volumeWorldAlignment(_ behavior: WorldAlignmentBehavior) -> some Scene

Discussion

For example, you can create a volume that remains parallel to the floor even when lifted up high above eye level by applying a gravityAligned alignment to the scene:

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        .windowStyle(.volumetric)
        .volumeWorldAlignment(.gravityAligned)
    }
}

The default value if you don’t apply the modifier is automatic. With that strategy, volumes will tilt themselves so the front remains fully visible while being repositioned.

See Also

Interacting with volumes