- 用Reality Composer編輯物件『屬性』,勾選『物理效果』『加入』
- 替arView加上手勢功能
arView.addGestureRecognizer(
UITapGestureRecognizer(
target: xxxx,
action: #selector(XXXX.handleTap(recognizer:))
)
)
@objc func handleTap(recognizer: UITapGestureRecognizer) {
let tapLocation = recognizer.location(in: arView)
let entity = arView.entity(at: tapLocation)
guard entity == boxAnchor?.steelBox else { return }
// entity 即點擊物件
}
沒有留言:
張貼留言