swift 如何为Reality Composer安装手势?

vc9ivgsu  于 2023-02-15  发布在  Swift
关注(0)|答案(1)|浏览(135)

加载场景后,我在Reality Composer(.rcproject)中添加了带有动画的USDZ,并添加到评论中
我尝试安装旋转缩放等手势...但不起作用

let ganGes = gangnim?.gnagnumObject as? (Entity & HasCollision)
arView.installGestures([.rotation,.translation,.scale], for: ganGes!)

如何将手势安装到Reality Composer?

unhi4e5o

unhi4e5o1#

要实现RealityKit的translaterotatescale手势,还需要调用generateCollisionShapes(recursive:)示例方法来准备用于碰撞检测的模型形状。

guard let ganGes = gangnim.gnagnumObject as? ModelEntity else { return }
ganGes.generateCollisionShapes(recursive: true)
arView.installGestures([.all], for: ganGes as (Entity & HasCollision))

相关问题