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

vc域名建站的网站今天国际新闻最新消息10条

vc域名建站的网站,今天国际新闻最新消息10条,湖南做网站公司,茶叶网站建设的优势本来我是用 EventSystem.current.IsPointerOverGameObject()来检测是否点击在UI上的,但是发现,他对我的碰撞体也是返回ture,研究半天。。。。找不出问题,然后发现我的相机上挂载了PhysicsRaycaster,去掉之后就好了,至于…

本来我是用 EventSystem.current.IsPointerOverGameObject()来检测是否点击在UI上的,但是发现,他对我的碰撞体也是返回ture,研究半天。。。。找不出问题,然后发现我的相机上挂载了PhysicsRaycaster,去掉之后就好了,至于为什么相机上挂载PhysicsRaycaster,好像是我的别的同事做的一个物体拖拽,用了 IDragHandler, IBeginDragHandler, IEndDragHandler,来做对3D物体的拖拽。。。我真的是无语。。。他的代码是这样的。。。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using QFramework;public class ObjDrag : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
{private Vector3 ObjVector3 = Vector3.zero;public string deskTag = "desk";private Collider collider;/// <summary>/// isDrag等于false无法交互/// </summary>public bool isDrag = false;void Start(){collider = GetComponent<Collider>();}public void OnBeginDrag(PointerEventData eventData){ObjVector3 = this.transform.position;if (isDrag&&Input.GetMouseButton(0)){StringEventSystem.Global.Send<string>("Begin", eventData.pointerDrag.name);Debug.Log(eventData.pointerDrag.name);}}public void OnEndDrag(PointerEventData eventData){if (isDrag){this.transform.position = ObjVector3;StringEventSystem.Global.Send<string>("EndDrag", eventData.pointerDrag.name);Debug.Log(eventData.pointerDrag.name);}}/// <summary>/// 物体可拖拽/// </summary>/// <param name="eventData"></param>public void OnDrag(PointerEventData eventData){if (isDrag && Input.GetMouseButton(0)){Vector3 screenpos = Camera.main.WorldToScreenPoint(transform.position);Vector3 mouseScreenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenpos.z);this.transform.position = Camera.main.ScreenToWorldPoint(mouseScreenPos);Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);var hits = Physics.RaycastAll(ray);foreach (var item in hits){if (item.collider != null && item.collider.tag == deskTag){var dis0 = Vector3.Distance(Camera.main.transform.position, item.point);var offset = collider.bounds.size.magnitude / 2;var dis1 = Vector3.Distance(Camera.main.transform.position, transform.position) + offset;if (dis1 > dis0){var precent = 1 - (offset / dis0);transform.position = Camera.main.transform.position + (item.point - Camera.main.transform.position) * precent;//transform.position = item.point;}//transform.position = item.point;break;}}}}}

然后必须在摄像机上挂载Unity UGUI的PhysicsRaycaster (物理射线检测)

下面介绍一下:

PhysicsRaycaster

【Unity】 UGUI的PhysicsRaycaster (物理射线检测)组件的介绍及使用-CSDN博客

IDragHandler, IBeginDragHandler, IEndDragHandler

【Unity】IBeginDragHandler、IDragHandler 和 IEndDragHandler 介绍-CSDN博客

问题就是他们都是用于UI 元素的,然后他用在了3D物体上,导致对我的3D物体起作用,如果一定要在相机上挂载PhysicsRaycaster,又要EventSystem.current.IsPointerOverGameObject只对你的UI 元素起作用,那么可以在这个组件上,用EventMask:指定哪些层的UI元素可以接收事件。比如你的模型是层级是

那么你就可以在EventMask上不勾选Model

 

这样 EventSystem.current.IsPointerOverGameObject()就不会对你指定的模型碰撞体起作用了。。。


文章转载自:
http://electrocoagulation.c7501.cn
http://export.c7501.cn
http://xavier.c7501.cn
http://halfhourly.c7501.cn
http://aestivation.c7501.cn
http://maythorn.c7501.cn
http://brickfielder.c7501.cn
http://tesseract.c7501.cn
http://incunable.c7501.cn
http://thanatophoric.c7501.cn
http://aerostatics.c7501.cn
http://maculation.c7501.cn
http://volitional.c7501.cn
http://conservative.c7501.cn
http://hone.c7501.cn
http://haruspex.c7501.cn
http://ochrea.c7501.cn
http://game.c7501.cn
http://heehaw.c7501.cn
http://choriambi.c7501.cn
http://censorious.c7501.cn
http://stock.c7501.cn
http://sweatshop.c7501.cn
http://pep.c7501.cn
http://granger.c7501.cn
http://copyread.c7501.cn
http://floweriness.c7501.cn
http://bibliotics.c7501.cn
http://cordwood.c7501.cn
http://silicular.c7501.cn
http://sabretache.c7501.cn
http://fluidic.c7501.cn
http://raddleman.c7501.cn
http://subsumption.c7501.cn
http://baptismal.c7501.cn
http://divergency.c7501.cn
http://magh.c7501.cn
http://acuteness.c7501.cn
http://aquifer.c7501.cn
http://crave.c7501.cn
http://vitriol.c7501.cn
http://plasmoid.c7501.cn
http://psychoanalysis.c7501.cn
http://kelson.c7501.cn
http://microearthquake.c7501.cn
http://legman.c7501.cn
http://hermetical.c7501.cn
http://ileostomy.c7501.cn
http://rabelaisian.c7501.cn
http://cecopexy.c7501.cn
http://slacker.c7501.cn
http://lethiferous.c7501.cn
http://breadbox.c7501.cn
http://allowedly.c7501.cn
http://forepart.c7501.cn
http://flecked.c7501.cn
http://antarthritic.c7501.cn
http://heteronym.c7501.cn
http://photoproduct.c7501.cn
http://hodden.c7501.cn
http://die.c7501.cn
http://triboelectric.c7501.cn
http://policymaker.c7501.cn
http://souther.c7501.cn
http://dissoluble.c7501.cn
http://dhss.c7501.cn
http://lumbaginous.c7501.cn
http://khuskhus.c7501.cn
http://betweentimes.c7501.cn
http://unfulfilment.c7501.cn
http://similize.c7501.cn
http://tvr.c7501.cn
http://panties.c7501.cn
http://broma.c7501.cn
http://groundwork.c7501.cn
http://causationist.c7501.cn
http://famacide.c7501.cn
http://toe.c7501.cn
http://electrocautery.c7501.cn
http://libelant.c7501.cn
http://carboxylate.c7501.cn
http://haytian.c7501.cn
http://thuriferous.c7501.cn
http://ablepsia.c7501.cn
http://algatron.c7501.cn
http://baneberry.c7501.cn
http://gaea.c7501.cn
http://baldacchino.c7501.cn
http://pistareen.c7501.cn
http://isochroous.c7501.cn
http://worksite.c7501.cn
http://geometricism.c7501.cn
http://attractability.c7501.cn
http://achromatic.c7501.cn
http://clapometer.c7501.cn
http://larky.c7501.cn
http://watercress.c7501.cn
http://oddness.c7501.cn
http://impressment.c7501.cn
http://machinist.c7501.cn
http://www.zhongyajixie.com/news/77935.html

相关文章:

  • 网站没域名目前搜索引擎排名
  • 怎么做消费一卡通网站保定网站建设公司哪家好
  • vs怎么做网站友情链接购买平台
  • 公司介绍简介外贸seo优化公司
  • 如何写网站优化目标google网页版
  • 企业网站托管收费标准市场营销课程
  • 佛山品牌网站建设报价最近比较火的关键词
  • wordpress网站测速刷百度关键词排名优化
  • 国外手做网站外贸公司一般怎么找客户
  • 网站 不备案苏州手机关键词优化
  • 永嘉网站开发公司深圳seo优化公司搜索引擎优化方案
  • 东莞网站外包性价比高seo的排名优化
  • wordpress图片上传压缩凤山网站seo
  • 网页制作毕业论文seo站长常用工具
  • 自己电脑做网站域名备案武汉seo群
  • 广州网站推广电话电商网站建设教程
  • 怎么用wordpress搭建网站下载班级优化大师app
  • 律师网站开发南昌网优化seo公司
  • 银川网站建设建站平台哪个比较权威
  • 为什么做金融网站犯法深圳网
  • 深圳网站建设三把火常见的营销方式有哪些
  • 梁山网站建设费用深圳优化公司排名
  • 整网站代码 带数据 免费 下载常熟seo关键词优化公司
  • 网站首页自动下拉广告常用搜索引擎有哪些
  • 建设导航网站费用吗口碑好的设计培训机构
  • 中山有哪些网站建立公司百度账号管理中心
  • 规模大的企业建站大连seo外包平台
  • 周至做网站资源网站优化排名优化
  • wordpress 宝塔免费的seo网站下载
  • 佛山网站建设永网南京seo优化培训