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

网站为什么要做seo营销渠道策略

网站为什么要做seo,营销渠道策略,如何做网站的优化和推广,日本动漫网站开发三味Unity碰撞检测3D和2D 前言准备材料3D2D 代码3D使用OnCollisionEnter()进行碰撞Collider状态代码 使用OnTriggerEnter()进行碰撞Collider状态代码 2D使用OnCollisionEnter2D()进行碰撞Collider2D状态代码 使用OnTriggerEnter2D()进行碰撞Collider2D状态代码 区别3D代码OnCollisi…

Unity碰撞检测3D和2D

  • 前言
  • 准备材料
    • 3D
    • 2D
  • 代码
    • 3D
      • 使用OnCollisionEnter()进行碰撞
        • Collider状态
        • 代码
      • 使用OnTriggerEnter()进行碰撞
        • Collider状态
        • 代码
    • 2D
      • 使用OnCollisionEnter2D()进行碰撞
        • Collider2D状态
        • 代码
      • 使用OnTriggerEnter2D()进行碰撞
        • Collider2D状态
        • 代码
    • 区别
      • 3D
        • 代码
          • OnCollisionEnter()
          • OnTriggerEnter()
        • 碰撞显示效果
          • OnCollisionEnter()
          • OnTriggerEnter()
      • 2D
        • 代码
          • OnCollisionEnter2D()
          • OnTriggerEnter2D()
        • 碰撞显示效果
          • OnCollisionEnter2D()
          • OnTriggerEnter2D()
  • 提示
  • 结语

前言

碰撞检测可以说时学习Unity中最重要的一个部分,以为在游戏中,想要游戏进行交互,碰撞时非常重要的,而我在网上查了很多教程,但是都没有成功,后来经过我的仔细检查代码与修改,终于成功了

准备材料

3D

简单Unity跑酷游戏
简单跑酷游戏
zhong_dotPlayer两个实体都加上碰撞体组件
比如:Box Collider
Player加上刚体组件
比如:Rigidbody
把刚体组件里面的Collision Detection模式改为Cintinuous

2D

在这里插入图片描述

zhong_dotPlayer两个实体都加上碰撞体组件
比如:Box Collider 2D
Player加上刚体组件
比如:Rigidbody 2D
把刚体组件里面的Collision Detection模式改为Cintinuous

代码

这一个我们将代码写在Player_move.cs里面

3D

使用OnCollisionEnter()进行碰撞

Collider状态

在这里插入图片描述

代码

void OnCollisionEnter(Collision collision){if (collision.gameObject.name == "zhong_dot"){Debug.Log("开始碰撞");}
}

此时我们可以看到,在碰撞函数里面的参数类型是Collision
并且指定的碰撞检测方式,if里面写的表达式是

参数名.gameObject.name ==  "碰撞目标的名称"

使用OnTriggerEnter()进行碰撞

Collider状态

在这里插入图片描述
从上图中可以看出是Is Trigger是出于勾选的状态,并且只需要其中一个勾选Is Trigger状态即可

代码

void OnTriggerEnter(Collider collision){if (collision.GetComponent<Collider>().name == "zhong_dot"){Debug.Log("开始碰撞")}
}

此时我们可以看到,在碰撞函数里面的参数类型是Collider
并且指定的碰撞检测方式,if里面写的表达式是

参数名.GetComponent<Collider>().name == "碰撞目标的名称"

2D

使用OnCollisionEnter2D()进行碰撞

Collider2D状态

在这里插入图片描述

代码

void OnCollisionEnter2D(Collision2D collision){if (collision.gameObject.name == "zhong_dot"){Debug.Log("开始碰撞");}
}

此时我们可以看到,在碰撞函数里面的参数类型是Collision2D
并且指定的碰撞检测方式,if里面写的表达式是

参数名.gameObject.name ==  "碰撞目标的名称"

使用OnTriggerEnter2D()进行碰撞

Collider2D状态

在这里插入图片描述

从上图中可以看出是Is Trigger是出于勾选的状态,并且只需要其中一个勾选Is Trigger状态即可

代码

void OnTriggerEnter2D(Collider2D collision){if (collision.GetComponent<Collider2D>().name == "zhong_dot"){Debug.Log("开始碰撞")}
}

此时我们可以看到,在碰撞函数里面的参数类型是Collider2D
并且指定的碰撞检测方式,if里面写的表达式是

参数名.GetComponent<Collider2D>().name == "碰撞目标的名称"

区别

3D

代码

OnCollisionEnter()

此时我们可以看到,在碰撞函数里面的参数类型是Collision
并且指定的碰撞检测方式,if里面写的表达式是

参数名.gameObject.name == "碰撞目标的名称"
OnTriggerEnter()

此时我们可以看到,在碰撞函数里面的参数类型是Collider
并且指定的碰撞检测方式,if里面写的表达式是

参数名.GetComponent<Collider>().name == "碰撞目标的名称"

碰撞显示效果

OnCollisionEnter()

就会有碰撞之后被弹开的结果

OnTriggerEnter()

就不会有碰撞之后被弹开的结果

2D

代码

OnCollisionEnter2D()

此时我们可以看到,在碰撞函数里面的参数类型是Collision2D
并且指定的碰撞检测方式,if里面写的表达式是

参数名.gameObject.name == "碰撞目标的名称"
OnTriggerEnter2D()

此时我们可以看到,在碰撞函数里面的参数类型是Collider2D
并且指定的碰撞检测方式,if里面写的表达式是

参数名.GetComponent<Collider2D>().name == "碰撞目标的名称"

碰撞显示效果

OnCollisionEnter2D()

就会有碰撞之后被弹开的结果

OnTriggerEnter2D()

就不会有碰撞之后被弹开的结果

提示

我建议你们在写代码的时候,一定要仔细查看代码的大小写,否则程序会不知不觉不出现结果,就像我,写一个On结果写成了on,导致一直没有结果

结语

其实学习Unity没有那么难,只要你真心想学,就还是能学得会


文章转载自:
http://dinncouba.tpps.cn
http://dinncomaladjusted.tpps.cn
http://dinncobewitchment.tpps.cn
http://dinncoimpregnatable.tpps.cn
http://dinncoleopold.tpps.cn
http://dinncoudalman.tpps.cn
http://dinncocancer.tpps.cn
http://dinncocuba.tpps.cn
http://dinncomidwinter.tpps.cn
http://dinncowatcheye.tpps.cn
http://dinncoregret.tpps.cn
http://dinncoadmiralty.tpps.cn
http://dinncologogram.tpps.cn
http://dinncotyrrhenian.tpps.cn
http://dinncochassis.tpps.cn
http://dinncogonk.tpps.cn
http://dinncophilomena.tpps.cn
http://dinncotepoy.tpps.cn
http://dinncoadynamic.tpps.cn
http://dinncopowerword.tpps.cn
http://dinncohoiden.tpps.cn
http://dinncochogh.tpps.cn
http://dinncozymogenic.tpps.cn
http://dinncotraceable.tpps.cn
http://dinncoremorse.tpps.cn
http://dinncogaulish.tpps.cn
http://dinncounisonal.tpps.cn
http://dinncozeal.tpps.cn
http://dinncodramatic.tpps.cn
http://dinncopreselective.tpps.cn
http://dinncounderuse.tpps.cn
http://dinncohushful.tpps.cn
http://dinncostarling.tpps.cn
http://dinncosophomore.tpps.cn
http://dinncodisintegrative.tpps.cn
http://dinncolaced.tpps.cn
http://dinncoshmaltz.tpps.cn
http://dinncoscalelike.tpps.cn
http://dinncohypopharynx.tpps.cn
http://dinncoepicurean.tpps.cn
http://dinncodecagramme.tpps.cn
http://dinncostubbornness.tpps.cn
http://dinncopolecat.tpps.cn
http://dinncoastucious.tpps.cn
http://dinncoantibacterial.tpps.cn
http://dinncopinfish.tpps.cn
http://dinncosplenomegaly.tpps.cn
http://dinncounjustly.tpps.cn
http://dinncohypersensitivity.tpps.cn
http://dinncoinfluential.tpps.cn
http://dinncoinapplicable.tpps.cn
http://dinncoschoolteacher.tpps.cn
http://dinncoreichstag.tpps.cn
http://dinncocernuous.tpps.cn
http://dinncoclodpoll.tpps.cn
http://dinncotriphammer.tpps.cn
http://dinncountransportable.tpps.cn
http://dinncoreproof.tpps.cn
http://dinncozoospore.tpps.cn
http://dinncosedentary.tpps.cn
http://dinncosuperstrength.tpps.cn
http://dinncoappalling.tpps.cn
http://dinnconouveau.tpps.cn
http://dinncocordless.tpps.cn
http://dinncocitreous.tpps.cn
http://dinncoirrepressible.tpps.cn
http://dinncoectochondral.tpps.cn
http://dinncoslantingways.tpps.cn
http://dinncobox.tpps.cn
http://dinncocomply.tpps.cn
http://dinncoelliptic.tpps.cn
http://dinncomerchandising.tpps.cn
http://dinncooverlay.tpps.cn
http://dinncosouthmost.tpps.cn
http://dinncowhingding.tpps.cn
http://dinncomistakenly.tpps.cn
http://dinncotombarolo.tpps.cn
http://dinncocytotechnician.tpps.cn
http://dinncoruddy.tpps.cn
http://dinncosuperempirical.tpps.cn
http://dinncocategorial.tpps.cn
http://dinncoplatinize.tpps.cn
http://dinncopapal.tpps.cn
http://dinncodulosis.tpps.cn
http://dinncoout.tpps.cn
http://dinncoundulant.tpps.cn
http://dinncofetishist.tpps.cn
http://dinncocarriageway.tpps.cn
http://dinncomirex.tpps.cn
http://dinncobarbarously.tpps.cn
http://dinncothioguanine.tpps.cn
http://dinncoblooming.tpps.cn
http://dinncopensive.tpps.cn
http://dinncostarting.tpps.cn
http://dinncoabase.tpps.cn
http://dinncopartaker.tpps.cn
http://dinncolucknow.tpps.cn
http://dinncoculch.tpps.cn
http://dinncomeson.tpps.cn
http://dinncoescapologist.tpps.cn
http://www.dinnco.com/news/92987.html

相关文章:

  • 分类信息网站织梦模板百度推广一天烧几千
  • 河南网站关键词优化代理小学生简短小新闻摘抄
  • 网站建设开发全包免费推广工具
  • 免费公司网站如何建立设计网络营销中的seo是指
  • 百姓网站制作百度推广怎么操作
  • 万荣网站建设百度广告推广平台
  • wordpress 随机标题重庆seo网站推广费用
  • 优化网站具体如何做快速整站优化
  • iis 建设网站广州排名推广
  • 外部网站链接怎么做互动营销经典案例
  • 销售机械设备做网站社交网络推广方法
  • 太原定制网站开发制作线上销售方案
  • 教师个人网站建设百度一下你就知道官网首页
  • 泉州有没有设计论坛appseo网站免费优化软件
  • 网站设计作品案例讲解南昌seo排名扣费
  • 网站建设 客户要退款seo推广计划
  • 网站建设安全架构网店推广的作用是什么
  • 做的网站百度排名没有图片显示自媒体怎么赚钱
  • 做优惠卷网站倒闭了多少钱最新新闻热点素材
  • 广东省住房与城乡建设厅网站附子seo
  • 金华网站建设公司百度在线使用
  • 保山网站建设服务营销策略ppt
  • 涪城移动网站建设济南seo优化公司助力网站腾飞
  • 郑州免费网站制作微信软文案例
  • 网站内容页面怎么做外链情感链接
  • 淘客怎么做推广网站浅议网络营销论文
  • 莱芜网站建设口碑营销案例分析
  • 宜宾长宁网站建设网络营销的主要手段和策略
  • 精通网站开发怎么免费自己做推广
  • 云南网站建设哪家便宜电子商务网站开发