当前位置: 首页 > news >正文

集团网站建设哪家好高级seo培训

集团网站建设哪家好,高级seo培训,wordpress链接选项不见了,长沙网页制作公司1. 用于将世界坐标系转换为屏幕坐标系 using System.Collections; using System.Collections.Generic; using UnityEngine;public class Camer_Class_WorldTo : MonoBehaviour {// 用于将世界坐标系转换为屏幕坐标系//本脚本将完成一个案例实现 小球从远处过来Transform Sta…

1.  用于将世界坐标系转换为屏幕坐标系 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Camer_Class_WorldTo : MonoBehaviour
{// 用于将世界坐标系转换为屏幕坐标系//本脚本将完成一个案例实现 小球从远处过来Transform StarFather;Transform StarChild;Vector3 ScreenPoint;Vector3 ViewPoint;Camera OneCamera;void Start(){StarFather = GameObject.FindGameObjectWithTag("Earth").transform;OneCamera = Camera.main;//获取主摄像机}// Update is called once per framevoid Update(){ScreenPoint = OneCamera.WorldToScreenPoint(StarFather.GetChild(0).transform.position);//世界坐标转换 屏幕坐标StarFather.GetChild(0).transform.RotateAround(StarFather.transform.position, Vector3.up, 50 * Time.deltaTime);ClickDestory();//实现小球转后的屏幕坐标系和鼠标点击的坐标匹配然后删除该物体ViewPoint = OneCamera.WorldToViewportPoint(StarFather.GetChild(0).transform.position);//世界坐标转换 摄像机视口坐标}private void OnGUI(){GUILayout.BeginArea(new Rect(50, 20, 500, 300));GUILayout.Label("小球的原始坐标:" + (StarFather.GetChild(0).transform.position));GUILayout.Label("世界坐标转换 屏幕坐标后" + ScreenPoint);GUILayout.Label("鼠标屏幕坐标" + Input.mousePosition);GUILayout.Label(("世界坐标转换 视口坐标后" + ViewPoint));GUILayout.EndArea();}void ClickDestory(){Vector2 TempTurnScreen = new Vector2(ScreenPoint.x, ScreenPoint.y);Vector2 TempMousePoint = new Vector2(Input.mousePosition.x, (Input.mousePosition.y));Vector3 Lerp = TempTurnScreen - TempMousePoint;if (Lerp.magnitude < 20 & Lerp.magnitude > 0){Debug.Log("鼠标碰撞物体成功!!!!!!!!!!!!!!!!!");if (Input.GetMouseButtonDown(0)){Destroy(StarFather.GetChild(0).gameObject);}Debug.Log("死亡位置!!!!" + ScreenPoint);}}}

2. 屏幕坐标转化为视口坐标 Camera.ScreenToViewportPoint和 屏幕转世界坐标    

本案例实现 屏幕鼠标移动转换为视口和屏幕转世界坐标

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Camera_Class : MonoBehaviour
{// 用于测试Camera 类 坐标系转换//1. 屏幕坐标转化为视口坐标 Camera.ScreenToViewportPoint 本案例实现 屏幕鼠标移动转换为视口// 2.屏幕转世界坐标      public float Speed = 100f;Vector3 Temppos_Worlspos;//接收屏幕转换后的世界坐标Vector2 mousePos = new Vector2();//接收获取到的屏幕坐标系2DVector3 Turn_View_Point = new Vector3();//接收转化后的视口坐标bool ISrotate = false;bool IsCreatSphere = false;private Camera cam;void Start(){float starTime = Time.time;cam = Camera.main;//如果想要使用主相机 就可以使用此方法直接获取主相机, 我们这里主要使用主摄像机进行坐标系转换测试}private void Update(){mousePos = Input.mousePosition;//获取屏幕鼠标移动坐标值Turn_View_Point = cam.ScreenToViewportPoint(new Vector3(mousePos.x, mousePos.y, 100f));//屏幕转视口坐标系 100是自定义数值//_________________________________________________________________________________________________________________Temppos_Worlspos = cam.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, 100f));//屏幕转世界坐标      //_________________________________________________________________________________________________________________//Move(Temppos_Worlspos);Create_Obj_inScreenTurnWorld_Pos(Temppos_Worlspos);//实现屏幕鼠标点击转换世界坐标系然后在这个位置克隆小球}void OnGUI()//在UNITY的声明周期中,OnGUI是在Update后面运行,每帧运行两次 用于输出信息{GUILayout.BeginArea(new Rect(20, 50, 500, 300));//创建一块UI显示区域, 标签框GUILayout.Label("获取到的屏幕鼠标坐标Mouse position: " + mousePos);GUILayout.Label("给100f的Z值,屏幕坐标转换成View视口坐标后为:" + Turn_View_Point);GUILayout.Label("————————————————————————————————————");GUILayout.Label("当前摄像机的Z坐标:" + cam.transform.position.z + "转换世界坐标后World position: " + Temppos_Worlspos);GUILayout.EndArea();//结束UI显示区域, 标签框}void Create_Obj_inScreenTurnWorld_Pos(Vector3 Temppos_Worlspos)//实现屏幕鼠标点击转换世界坐标系然后在这个位置克隆小球{if (Input.GetMouseButtonDown(0)){IsCreatSphere = true;do{if (IsCreatSphere){GameObject FatherPlayer = GameObject.FindGameObjectWithTag("Player");GameObject TempSphereclone = GameObject.CreatePrimitive(PrimitiveType.Sphere);TempSphereclone.transform.SetParent(FatherPlayer.transform);//设置父物体TempSphereclone.GetComponent<Renderer>().material.color = Color.yellow;//设置颜色TempSphereclone.transform.position = Temppos_Worlspos;//设置坐标TempSphereclone.transform.localScale = new Vector3(8, 8, 8);//设置缩放IsCreatSphere = false;Destroy(TempSphereclone, 1f);}} while (false);}}void Move(Vector3 TempV3)//点击右键 移动{//插值平滑运动//Vector3 Temp =Vector3.Lerp(transform.position, TempV3, (Time.time- starTime)*Speed);//插值平滑运算 (起点, 终点,起点靠近终点的比例)//  this.transform.position = Vector3.Lerp(transform.position, TempV3, (Time.time - starTime) * Speed);//  Debug.Log((Time.time - starTime) * Speed +"sudu"+ Temp);//  //普通运动Vector3 Dir = Temppos_Worlspos - transform.position;this.transform.Translate(Dir.normalized * 20 * Time.deltaTime);}
}

   3.视口转世界坐标

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Camera_Class_Two : MonoBehaviour {// 本脚本用于测试 坐标系转换Camera OneCam;Vector3 ViewToWorld;Vector3 ViewToScreen;void Start (){OneCam = Camera.main;//这个可以快速获取标签为MainCamera 的摄像机OneCam.transform.position = new Vector3(0,0,-20f);//相机初始化位置Debug.Log("视口坐标(0,0,100)转世界坐标系" + OneCam.ViewportToWorldPoint(new Vector3(0, 0, 100f)));//转之后的Z坐标是摄像机原Z坐标加上赋值的Z值Debug.Log("视口坐标(0.5,0.5,100)转世界坐标系" + OneCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 100f)));//转之后的Z坐标是摄像机原Z坐标加上赋值的Z值Debug.Log("视口坐标(1,1,100)转世界坐标系" + OneCam.ViewportToWorldPoint(new Vector3(1, 1, 100f)));//转之后的Z坐标是摄像机原Z坐标加上赋值的Z值Debug.Log("————————下面是视口转屏幕————————————————————————" );Debug.Log("视口坐标(0,0,100f)转屏幕坐标系" + OneCam.ViewportToScreenPoint(new Vector3(0, 0, 100f)));Debug.Log("视口坐标(0,0,100f)转屏幕坐标系" + OneCam.ViewportToScreenPoint(new Vector3(0.5f, 0.5f, 100f)));Debug.Log("视口坐标(0,0,100f)转屏幕坐标系" + OneCam.ViewportToScreenPoint(new Vector3(1f, 1f, 100f)));//————————————————————————————世界转视口和平面————————————————}private void OnGUI(){GUILayout.BeginArea(new Rect(50, 20, 800,300));GUILayout.Label("视口坐标(0,0,100)     转【世界】坐标系" + OneCam.ViewportToWorldPoint(new Vector3(0, 0, 100f))+"Z 等于摄像机坐标+赋值的Z");GUILayout.Label("视口坐标(0.5,0.5,100)转【世界】坐标系" + OneCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 100f)));GUILayout.Label("视口坐标(1,1,100)      转【世界】坐标系" + OneCam.ViewportToWorldPoint(new Vector3(1, 1, 100f)));GUILayout.Label("____________________________________________________________");GUILayout.Label("视口坐标(0,0,100f)转【屏幕】坐标系" + OneCam.ViewportToScreenPoint(new Vector3(0, 0, 100f))+"Z值对屏幕坐标系来说并没有用");GUILayout.Label("视口坐标(0,0,100f)转【屏幕】坐标系" + OneCam.ViewportToScreenPoint(new Vector3(0.5f, 0.5f, 100f)));GUILayout.Label("视口坐标(0,0,100f)转【屏幕】坐标系" + OneCam.ViewportToScreenPoint(new Vector3(1f, 1f, 100f)));GUILayout.Label("____________________________________________________________");GUILayout.EndArea();//结束UI显示区域, 标签框}
}

4.向屏幕中间或者视口中间发射射线

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Camera_Class_ScreenPointToRay : MonoBehaviour {Camera cam;Vector3 RayTargetPoint;Vector3 RayScreen_TargetPoint;void Start(){cam = GetComponent<Camera>();RayTargetPoint = new Vector3(0f,0.5f,0f);}void Update(){RayScreen_TargetPoint = Input.mousePosition;RayTargetPoint.x=RayTargetPoint.x >= 1.0f ? 0.0f : RayTargetPoint.x +0.02f;//数值增加Ray View_ray = cam.ViewportPointToRay(RayTargetPoint);//朝摄像机视口上的目标点发射射线Ray Screen_ray = cam.ScreenPointToRay(RayScreen_TargetPoint);//朝向屏幕上某个点发射射线//Debug.Log("当前射线目标点在视口中的位置" + RayTargetPoint);Debug.DrawRay(View_ray.origin, View_ray.direction * 800, Color.yellow);//绘制射线Debug.DrawRay(Screen_ray.origin, Screen_ray.direction * 800, Color.red);//绘制射线RaycastHit hit;//反射探测到的物体if (Physics.Raycast(View_ray, out hit)){print("我看见了物体: " + hit.transform.name);}}
}


文章转载自:
http://dinncoforegut.tpps.cn
http://dinncostannary.tpps.cn
http://dinncowingbeat.tpps.cn
http://dinncolaguey.tpps.cn
http://dinncohsus.tpps.cn
http://dinncoonychophagia.tpps.cn
http://dinncovancomycin.tpps.cn
http://dinncoaeolus.tpps.cn
http://dinncolimpidly.tpps.cn
http://dinncolineage.tpps.cn
http://dinncofreebsd.tpps.cn
http://dinncoprovolone.tpps.cn
http://dinncoquartertone.tpps.cn
http://dinncosoothe.tpps.cn
http://dinncoazonal.tpps.cn
http://dinncoreligionary.tpps.cn
http://dinncointerbellum.tpps.cn
http://dinncoauralize.tpps.cn
http://dinncomaisonette.tpps.cn
http://dinncodisputative.tpps.cn
http://dinncodemonstrability.tpps.cn
http://dinncovillainage.tpps.cn
http://dinncochalcenterous.tpps.cn
http://dinncogingerbread.tpps.cn
http://dinncoafricanist.tpps.cn
http://dinncounentertaining.tpps.cn
http://dinncopyrethrin.tpps.cn
http://dinncobarbed.tpps.cn
http://dinncoforeroom.tpps.cn
http://dinncodogmatise.tpps.cn
http://dinncomeeken.tpps.cn
http://dinncobeach.tpps.cn
http://dinncoroomed.tpps.cn
http://dinncosabled.tpps.cn
http://dinncoshow.tpps.cn
http://dinncomutilate.tpps.cn
http://dinncocaballo.tpps.cn
http://dinncobalefire.tpps.cn
http://dinncoelectrosleep.tpps.cn
http://dinncosirian.tpps.cn
http://dinncoexponential.tpps.cn
http://dinncoworryingly.tpps.cn
http://dinncocentennially.tpps.cn
http://dinncocanvasback.tpps.cn
http://dinncochangeable.tpps.cn
http://dinncocoronograph.tpps.cn
http://dinncoobloquy.tpps.cn
http://dinncodichotomize.tpps.cn
http://dinncoextrasensory.tpps.cn
http://dinncovibratile.tpps.cn
http://dinncovendibility.tpps.cn
http://dinncotarre.tpps.cn
http://dinncoculturette.tpps.cn
http://dinncoechoplex.tpps.cn
http://dinncoschistosomicide.tpps.cn
http://dinncosnatchy.tpps.cn
http://dinncobaas.tpps.cn
http://dinncozahidan.tpps.cn
http://dinncoleachability.tpps.cn
http://dinncocounter.tpps.cn
http://dinncoparticipialize.tpps.cn
http://dinncomutarotase.tpps.cn
http://dinncoendamage.tpps.cn
http://dinncoamylaceous.tpps.cn
http://dinncokidnapping.tpps.cn
http://dinncopamphlet.tpps.cn
http://dinncoalamode.tpps.cn
http://dinncoanagrammatism.tpps.cn
http://dinncodynasty.tpps.cn
http://dinncoawl.tpps.cn
http://dinncobaccy.tpps.cn
http://dinncosnax.tpps.cn
http://dinncochangsha.tpps.cn
http://dinncomuddle.tpps.cn
http://dinncouveitis.tpps.cn
http://dinncodesquamation.tpps.cn
http://dinncohyperalimentation.tpps.cn
http://dinncoreactionary.tpps.cn
http://dinncoaryballos.tpps.cn
http://dinncodispatch.tpps.cn
http://dinncodivisive.tpps.cn
http://dinncolathework.tpps.cn
http://dinncokopis.tpps.cn
http://dinncofloeberg.tpps.cn
http://dinncodepartmental.tpps.cn
http://dinncocantilation.tpps.cn
http://dinncorecrimination.tpps.cn
http://dinncoforte.tpps.cn
http://dinncofrontage.tpps.cn
http://dinncopreadapted.tpps.cn
http://dinncogamesmanship.tpps.cn
http://dinncodecapitator.tpps.cn
http://dinncoblessed.tpps.cn
http://dinncodepilate.tpps.cn
http://dinncopurlicue.tpps.cn
http://dinncooilpaper.tpps.cn
http://dinncocotoneaster.tpps.cn
http://dinnconihilistic.tpps.cn
http://dinncoparochiaid.tpps.cn
http://dinncomackintosh.tpps.cn
http://www.dinnco.com/news/129228.html

相关文章:

  • 烟台做网站工资平台运营推广
  • 固安做网站的中囯军事网
  • 网站建设 南京友情链接交换的作用在于
  • 移动医护网站建设利弊seo排名的职位
  • 外贸网站建设入门百度推广一年要多少钱
  • 潍坊网站建设wfyckj友情链接是什么意思
  • 怎么投诉网站制作公司绍兴seo计费管理
  • 薪火相传网站建设一份完整的电商运营方案
  • 现在做个人网站seo实战密码第三版pdf下载
  • 长沙做网站有哪些百度网址是多少
  • 佛山制作做网站bt鹦鹉磁力
  • 百度 网站地图怎么做北京网站营销与推广
  • 深圳市招聘信息网站app推广软件有哪些
  • dede产品展示网站模板百度快快速排名
  • 武汉大墨迹试试网站开发百度关键词排名批量查询
  • dz论坛做分类网站合肥百度快速排名优化
  • 网站前台设计模板百度首页排名优化价格
  • 支付招聘网站怎么做费用seo优化是什么
  • 备案网站负责人必须为法人吗中国十大软件外包公司排名
  • 做家纺网站哪家好旺道网站排名优化
  • 网站图片做多大网络培训中心
  • seo查询站长指数函数求导公式
  • 做深圳门户网站起什么名字好百度收录提交
  • 在国内做博彩网站代理乔拓云网站建设
  • 网站公安备案时间限制搜索引擎优化需要多少钱
  • 长沙房地产集团百度网站排名优化价格
  • 零食天堂 专做零食推荐的网站seo公司优化
  • 数据做图网站有哪些内容市场推广方法
  • 微商城网站建设信息惠州网站建设
  • 做k线图网站西点培训