contributors |
---|
coughski |
There are 3 ways to display content in visionOS:
- Window: 2D content
- Volume: bounded 3D experiences
- Full Space: display of unbounded 3D content
This talk focuses on Volumes.
- Can use without any windows
- Provides a fixed scale container
- Unlike windows, maintains the same size at any distance
- Horizontally aligned, and support viewing from any angle
- Doesn't take over the entire space
- Use
.windowStyle(.volumetric)
modifier on a WindowGroup
- A RealityKit view to load simple 3D scenes asynchronously
- Similar to
AsyncImage
, you can use placeholders during loading - Use
.resizable
modifier with model, similar toImage
- Default alignment is against back plane. Otherwise, use
.frame(depth:alignment:)
with.front
alignment - Can use
.glassBackgroundEffect()
to make text labels readable in visionOS
Use for more involved 3D scenes
Can use RealityKit's Entity-Component system for advanced rendering
- Pair tagged (
.tag
) SwiftUI views with Entity inside RealityView - Useful for adding annotations or editing affordances
- These live views can respond to state changes, run animations, and handle gestures
- Existing gestures supported in 3D
- Hands, eyes, trackpad mechanics supported
Add InputTargetComponent
to RealityKit Entity to receive input
CollisionComponent
is used to define shape of entity's interactive region
Can use SpatialTapGesture
to allow user to interact with entity
.targetedToEntity
modifier ties gestures to specific entities
Convert from SwiftUI local space to scene's coordinate space
Instead of loading another model using RealityKit, you can add a Model3D
as an attachment
RotateGesture3D
is another new gesture you can use