前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >VR+全景播放器+头控讲解-04

VR+全景播放器+头控讲解-04

作者头像
酷走天涯
发布2018-09-14 15:08:26
5650
发布2018-09-14 15:08:26
举报
文章被收录于专栏:每日一篇技术文章
本节学习目标

如何实现通过手势移动来调节呈现出来的画面位置

实现步骤
  • 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 中文教程

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017.03.26 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 本节学习目标
  • 实现步骤
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档