ARkit -- 旋转

2017-11-02  本文已影响401人  li_礼光



代码测试

//旋转手势
let rotationGesture = UIRotationGestureRecognizer(target: self, action: #selector(didRotate(_:)))
sceneView.addGestureRecognizer(rotationGesture)


@objc
func didRotate(_ gesture: UIRotationGestureRecognizer) {
    guard gesture.state == .changed else { return }
    guard let node = node else { return  }
    node.eulerAngles.y -= Float(gesture.rotation)
    gesture.rotation = 0
}
旋转属性 效果图

旋转比较简单,不涉及到复杂的矩阵运算,自己对应修改不同的轴的角度就好.

上一篇 下一篇

猜你喜欢

热点阅读