RealityKit & Reality Composer Pro

Mar 27 2024 · Swift 5.10, visionOS 1.1, Xcode 15.3

Lesson 03: Creating Interactions in RealityKit & Reality Composer Pro

Demo

Episode complete

Play next episode

Next

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Start with the QHoops app in the Starter folder. This is Vision Pro project like before, minus the boilerplate scene. Once again, you’ll use the Show Immersion toggle to load and reset the scene.

Toggle("Show ImmersiveSpace", systemImage: "mountain.2", isOn: $showImmersiveSpace)
let floor = ModelEntity(mesh: .generatePlane(width: 100, depth: 100), materials: [OcclusionMaterial()])
floor.generateCollisionShapes(recursive: false)
floor.components[PhysicsBodyComponent.self] = .init(
  massProperties: .default,
  mode: .static
)
content.add(floor)
var dragGesture: some Gesture {
  DragGesture()
    .targetedToAnyEntity()
    .onChanged { value in
      value.entity.position = value.convert(value.location3D, from: .local, to: value.entity.parent!)
      value.entity.components[PhysicsBodyComponent.self]?.mode = .kinematic
    }
}
.gesture(dragGesture)
See forum comments
Cinema mode Download course materials from Github
Previous: Instruction Next: Conclusion