Skip to content

Instantly share code, notes, and snippets.

@sorin-ref
Last active December 9, 2023 12:18
Show Gist options
  • Save sorin-ref/9d59fbb287dd4c2c4c325800d0a16f63 to your computer and use it in GitHub Desktop.
Save sorin-ref/9d59fbb287dd4c2c4c325800d0a16f63 to your computer and use it in GitHub Desktop.
import RealityKit
import UIKit
import PlaygroundSupport
let arView = ARView(frame: CGRect() , cameraMode: .ar, automaticallyConfigureSession: true)
PlaygroundPage.current.setLiveView(arView)
let planeAnchor = AnchorEntity(plane: .horizontal)
arView.scene.addAnchor(planeAnchor)
let ballMesh = MeshResource.generateSphere(radius: 0.1)
let ballMaterial = SimpleMaterial(color: .purple, isMetallic: false)
let ball = ModelEntity(mesh: ballMesh, materials: [ballMaterial])
ball.position = [0.0, 0.1, 0.0]
planeAnchor.addChild(ball)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment