VR+全景播放器+头控讲解-04
生活随笔
收集整理的這篇文章主要介紹了
VR+全景播放器+头控讲解-04
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
VR+全景播放器+頭控講解-01-知識儲備
VR+全景播放器+頭控講解-02-創建球體
VR+全景播放器+頭控講解-03-渲染視頻
VR+全景播放器+頭控講解-04-滑動手勢
VR+全景播放器+頭控講解-05-伸縮畫面
VR+全景播放器+頭控講解-06-頭控實現
VR+全景播放器+頭控講解-07-分屏技術
本節學習目標
如何實現通過手勢移動來調節呈現出來的畫面位置
實現步驟
-
1.單獨創建一個視圖放在最外層,放手勢對象
[view addGestureRecognizer:self.panGesture]; -
2.創建一個滑動手勢
self.pinchGesture = [[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(pinchGesture:)]; -
3.轉換為旋轉角度
if (panGesture.state == UIGestureRecognizerStateBegan){CGPoint currentPoint = [panGesture locationInView:panGesture.view];self.lastPoint_x = currentPoint.x;self.lastPoint_y = currentPoint.y;[self.delegate gestureManager:self panGesture:panGesture matrix4:SCNMatrix4Identity]; }else{CGPoint currentPoint = [panGesture locationInView:panGesture.view];float distX = currentPoint.x - self.lastPoint_x;float distY = currentPoint.y - self.lastPoint_y;self.lastPoint_x = currentPoint.x;self.lastPoint_y = currentPoint.y;// 這里進行手勢滑動視角的微調,根據需求設置distX *= -0.005;distY *= -0.005;self.fingerRotationY += distX * OSVIEW_CORNER / 100.0;self.fingerRotationX += distY * OSVIEW_CORNER / 100.0;SCNMatrix4 modelMatrix = SCNMatrix4Identity;modelMatrix = SCNMatrix4Rotate(modelMatrix, self.fingerRotationX,1, 0, 0);modelMatrix = SCNMatrix4Rotate(modelMatrix, self.fingerRotationY, 0, 1, 0); -
4.改變照相機的旋轉角度
self.eyeNode.pivot = modelMatrix;
本節講解完畢
SceneKit 中文教程
總結
以上是生活随笔為你收集整理的VR+全景播放器+头控讲解-04的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机上某个程序破坏,打开Excel出现
- 下一篇: arcgis密度分析