Last active
December 9, 2023 12:18
-
-
Save sorin-ref/9d59fbb287dd4c2c4c325800d0a16f63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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