位置: 编程技术 - 正文

摄像机各种效果(各种摄像机的介绍)

编辑:rootadmin
/// <summary>/// Mouse orbit./// This script use to control a main camera/// </summary>using UnityEngine;using System.Collections;public class MouseOrbit : MonoBehaviour {[HideInInspector]public GameObject target; //a target look at public float xSpeed; //speed pan xpublic float ySpeed; //speed pan ypublic float yMinLimit; //y min limitpublic float yMaxLimit; //y max limit public float scrollSpeed; //scroll speedpublic float zoomMin; //zoom minpublic float zoomMax; //zoom max//Private variableprivate float distance;private float distanceLerp;private Vector3 position; private bool isActivated; private float x;private float y;// private bool setupCamera; // Use this for initialization void Start () {//Warning when not found targetif(target == null){target = GameObject.FindGameObjectWithTag("Player");if(target == null){Debug.LogWarning("Don't found player tag please change player tag to Player");}} //Setup PosVector3 angles = transform.eulerAngles;x = angles.y;y = angles.x;//摄像机的视野范围 CalDistance(); } void LateUpdate () { ScrollMouse();RotateCamera(); }//Roate camera method//实现摄像机跟随和相机旋转效果void RotateCamera(){if (Input.GetMouseButtonDown(1)){ isActivated = true; } // if mouse button is let UP then stop rotating camera if (Input.GetMouseButtonUp(1)){isActivated = false;} if (target && isActivated) { y -= Input.GetAxis("Mouse Y") * ySpeed; x &#;= Input.GetAxis("Mouse X") * xSpeed; y = ClampAngle(y, yMinLimit, yMaxLimit); Quaternion rotation = Quaternion.Euler(y, x, 0);Vector3 calPos = new Vector3(0, 0, -distanceLerp); position = rotation * calPos &#; target.transform.position; transform.rotation = rotation; transform.position = position; } else{Quaternion rotation = Quaternion.Euler(y, x, 0);Vector3 calPos = new Vector3(0, 0, -distanceLerp); position = rotation * calPos &#; target.transform.position; transform.rotation = rotation; transform.position = position;}} //Calculate Distance Method//摄像机的视野范围 void CalDistance(){distance = zoomMax;distanceLerp = distance;Quaternion rotation = Quaternion.Euler(y, x, 0);Vector3 calPos = new Vector3(0, 0, -distanceLerp); position = rotation * calPos &#; target.transform.position; transform.rotation = rotation; transform.position = position;}//Scroll Mouse Methodvoid ScrollMouse(){distanceLerp = Mathf.Lerp(distanceLerp,distance,Time.deltaTime * 5);if (Input.GetAxis("Mouse ScrollWheel") != 0 && !GUI_Menu.instance.CheckHoverItemShop() && !GUI_Menu.instance.CheckHoverSkillWindow()) { // get the distance between camera and target distance = Vector3.Distance (transform.position , target.transform.position); distance = ScrollLimit(distance - Input.GetAxis("Mouse ScrollWheel")*scrollSpeed, zoomMin, zoomMax); }} //Scroll Limit Methodfloat ScrollLimit(float dist, float min, float max) { if (dist < min) dist= min; if (dist > max) dist= max; return dist; }//Clamp Angle Methodfloat ClampAngle(float angle,float min,float max){if(angle < -)angle &#;= ;if(angle > )angle -= ;return Mathf.Clamp(angle,min,max);}}

推荐整理分享摄像机各种效果(各种摄像机的介绍),希望有所帮助,仅作参考,欢迎阅读内容。

摄像机各种效果(各种摄像机的介绍)

文章相关热门搜索词:摄像机各种效果图,各种摄像机的介绍,摄像机各种效果图片,摄像机拍摄效果,摄像机各种效果图片,各种摄像机的介绍,摄像机各种效果对比,摄像机各种效果图,内容如对您有帮助,希望把文章链接给更多的朋友!

如何防范unity代码被偷! 解密无非就为了修改游戏功能数据、提取游戏资源、加入自己想加的广告等等加密就是保护游戏资源不被恶意修改关于UnityC#代码部分的加密,混淆,可

[置顶] 用Unity写了一个类似汤姆猫自动检测说话功能 简单的把脚本加到摄像机上就行下面是我写的脚本,有个问题因为是自动调用检测的调用录音unity调用有延时会出现一些延时小问题,可以参考我的代码

[置顶] Unity处理Hierarchy面板上的一些特殊的对象的特殊标识 孙广东.5.转载请注明出处:

标签: 各种摄像机的介绍

本文链接地址:https://www.jiuchutong.com/biancheng/372847.html 转载请保留说明!

上一篇:Unity3D入门——GUI的Label控件(unity3d documentation)

下一篇:如何防范unity代码被偷!(unity如何避免碰撞穿透)

  • 网上代增值税开错不退
  • 企业所得税从业人数怎么填,依据什么填写
  • 如何做进项税额转出,又认证不了发票
  • 企业如何代扣代缴劳务报酬所得税
  • 旅游开发公司有什么职位
  • 注销时其他应付款余额怎么账务处理
  • 应付账款扣除商业折扣
  • 以前漏记的成本怎么处理
  • 境外企业提供国外服务
  • 新会计准则要求
  • 专业合作社的业务范围
  • 外管证税收预缴税率是多少?
  • 员工被单位罚款须要问单位要收据吗
  • 上个月没有报个税这个月一起报
  • 企业业务招待费标准规定
  • 银行要求的补偿性余额所占比例为20%
  • 资产计税基础是怎么填
  • 财务部水电费会计分录
  • 个税专项扣除有几项
  • 固定资产暂估入账后续调整
  • 账面上挂的其他应付款怎么冲平?
  • 土地无形资产怎么估值
  • 苹果mac有hdmi
  • 长期资本负债率怎么计算公式
  • 政府拨款经费会计分录
  • 上季度成本多结转了怎么调
  • 银行汇票和银行本票区别图解
  • 出口零申报步骤
  • 流转税政策
  • 营业执照年检认缴和实缴怎么填
  • 暂估入库含税还是含税
  • 增值税发票支票号
  • html下划线怎么设置
  • 特斯拉 ai day
  • 织梦怎么添加相关
  • qt无边框窗口设计
  • 实收资本确认时间什么入账
  • 比赛奖金怎么做账
  • 销售折扣现金流量表
  • 出差补贴要不要交个税呢?
  • 公司代缴个税怎么做账
  • 小规模公司购买汽车会计分录
  • 收到员工交来的宿舍费
  • 社保刚转回来,生孩子能报销吗
  • 春节重要通知发放工资
  • 会计凭证保管期限30年是哪一年开始的
  • 公司采购产品赠送给客户会计分录
  • 会计估计变动怎么处理
  • 分公司可以设立公司吗
  • 电梯在固定资产里属于什么设备类别
  • 新注册的公司怎么申报个税
  • mysql关联查询原理
  • MySQL Semisynchronous Replication介绍
  • sql server中Select count(*)和Count(1)的区别和执行方式
  • mysql5.7分区表
  • win10系统无法安装打印机句柄无效
  • centos 网络监控
  • ubuntu18.04网络
  • linux进程管理实验总结
  • Win7自带的扫雷怎么都打不开
  • 怎么提高局域网安全
  • Windows8和Windows8 RT版的区别介绍
  • Win10系统安装步骤
  • win10系统怎么cmd
  • Ubuntu 下搭建网站服务器
  • cocos2dx-js
  • opengl sharder
  • javascript中的document.write
  • vue源码是用什么写的
  • unity rp
  • js原生方法大全
  • javascript语言介绍
  • android software
  • jquery input checked
  • 土地增值税计税
  • 行政服务事项包含哪些
  • 研发人员范围
  • 写给税务局的表扬信
  • 外出经营需要交哪些税
  • 盘州市税务局党组成员图片
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设