Skip to content

Instantly share code, notes, and snippets.

@eospi
Created August 13, 2019 16:08
Show Gist options
  • Save eospi/af9a60d240489a5e0c91082a33067d91 to your computer and use it in GitHub Desktop.
Save eospi/af9a60d240489a5e0c91082a33067d91 to your computer and use it in GitHub Desktop.
Gestures in RealityKit
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