照相机根据触摸围绕目标旋转
来源:互联网 发布:域名是什么样子 编辑:程序博客网 时间:2024/05/22 12:11
Transform m_Rounder = Camera.main.transform;Transform m_Center = m_TargetXingqiu.transform;//当前触摸的坐标与上一个触摸坐标的偏移量Vector2 offsetPos = m_TouchCurPos - m_TouchPrePos;//围绕半径float radius = (m_Rounder.position - m_Center.position).magnitude;//相机到目标的向量Vector3 camRelativeToTarget = Vector3.Normalize(m_Rounder.position - m_Center.position);//触摸为照相机坐标,将此坐标转为世界坐标Vector3 touchCurWorldPos = m_Rounder.localToWorldMatrix.MultiplyPoint(new Vector3(m_TouchCurPos.x, m_TouchCurPos.y, 0f));Vector3 touchPreWorldPos = m_Rounder.localToWorldMatrix.MultiplyPoint(new Vector3(m_TouchPrePos.x, m_TouchPrePos.y, 0f));//触摸方向向量转世界向量Vector3 touchVec = touchCurWorldPos - touchPreWorldPos;//围绕的旋转轴Vector3 roundAxis = Vector3.Cross(touchVec, camRelativeToTarget);m_Rounder.RotateAround (m_Center.position, Vector3.Normalize(roundAxis), roundAxis.magnitude*0.1f);
0 0
- 照相机根据触摸围绕目标旋转
- 相机围绕目标旋转
- 控制摄像机围绕目标旋转观察
- 围绕旋转
- 根据触摸点将精灵旋转一定角度
- 围绕中心点进行旋转
- 摄像机围绕人物旋转
- android 围绕中心旋转动
- android 围绕中心旋转动画
- android 围绕中心旋转动画
- css3围绕圆形旋转思路
- android 围绕中心旋转动画
- 围绕中心旋转动画效果
- android 围绕中心旋转动画
- 摄像机围绕物体旋转观察
- Unity之一天一个技术点(十三)---以指定对象为中心,根据鼠标位置旋转照相机
- 游戏中主角根据触摸点来旋转对应的角度
- android Bitmap围绕一个点进行旋转
- 20个常用的正则表达式
- 2013.04-rc2uboot移植(建立编译模板)
- Linux课堂笔记(4)
- 加密锁复制技术 软件分析技术
- [置顶] Android Notification和权限机制探讨
- 照相机根据触摸围绕目标旋转
- PHP 数组和字符串互相转换实现方法
- 内存泄漏及管理(02)-内存泄漏的分析和处理
- Linux 动态库与静态库制作及使用详解
- call与apply(2) //有疑问
- 图形学之深度缓存简介
- WAV 文件格式分析
- Java四种代码块及运行优先级
- Linux静态库的使用