Created
August 13, 2019 16:08
-
-
Save eospi/af9a60d240489a5e0c91082a33067d91 to your computer and use it in GitHub Desktop.
Gestures in RealityKit
This file contains 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 | |
class ViewController: UIViewController { | |
let arView: ARView | |
func addGestures() { | |
// Use any entity. Here we're using a cube with size 0.5m | |
let entity = ModelEntity(mesh: MeshResource.generateBox(size: 0.5)) | |
entity.generateCollisionShapes(recursive: true) | |
// choose .translation, .rotation, .scale, or .all | |
arView.installGestures(.translation, for: entity) | |
// OPTIONAL: make a selection of gestures from an array literal | |
// arView.installGestures(.init(arrayLiteral: [.translation, .scale]), for: entity) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment