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

昆山规模的网站建设公司有哪些b站推广网站入口2023的推广形式

昆山规模的网站建设公司有哪些,b站推广网站入口2023的推广形式,网站建设优化外包,淮安做网站的有多少目录 备注内容 1游戏物体的父子级关系 1.1 父子物体 1.2 坐标关系 1.3 父子物体实际是用 每个gameobject的tranform来关联的 2 获取gameObject的静态数据 2.1 具体命令 2.2 具体代码 2.3 输出结果 3 获取gameObject 的方向 3.1 游戏里默认的3个方向 3.2 获取方向代…

目录

备注内容

1游戏物体的父子级关系

1.1 父子物体

1.2 坐标关系

1.3 父子物体实际是用 每个gameobject的tranform来关联的

2  获取gameObject的静态数据

2.1 具体命令

2.2 具体代码

2.3 输出结果

3 获取gameObject 的方向

3.1 游戏里默认的3个方向

3.2 获取方向代码

3.3 输出

4 游戏里的  旋转,朝向

4.1 始终朝向某点:transform.LookAt() 

4.2  自转  transform.Rotate()

4.3  公转 transform.RotateAround()

4.4 自转+公转的  Sun- Earth- Moon 效果

5 游戏里的直线移动 transform.Translate()

5 游戏里 gameObject的父子关系


备注内容

  • 注释  //
  • 注释  /*  */  大段block注释

1游戏物体的父子级关系

1.1 父子物体

  • 游戏物体的父子级关系
  • 实际是用 每个gameobject的tranform来关联的

1.2 坐标关系

  • tranform.position           //这个是unity里的绝对位置
  • tranform.localPosition    //这个是相对于父物体的位置,也是unity编辑器里显示的坐标位置

1.3 父子物体实际是用 每个gameobject的tranform来关联的

  • 父子物体实际是用 每个gameobject的tranform来关联的

2  获取gameObject的静态数据

2.1 具体命令

//获取位置

       Debug.Log(transform.position);                     // 返回一个Vector3

       Debug.Log(transform.localPosition);            // 返回一个Vector3

//获取旋转的四元数,和欧拉角

       Debug.Log(transform.rotation);                    // 返回四元数

       Debug.Log(transform.localRotation);

       Debug.Log(transform.eulerAngles);             // 返回一个Vector3

       Debug.Log(transform.localEulerAngles);      // 返回一个Vector3

//获取缩放

       Debug.Log(transform.localScale);                // 返回一个Vector3

2.2 具体代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class TransformTest : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){//获取位置Debug.Log(transform.position);Debug.Log(transform.localPosition);//获取旋转的四元数,和欧拉角Debug.Log(transform.rotation);Debug.Log(transform.localRotation);Debug.Log(transform.eulerAngles);Debug.Log(transform.localEulerAngles);//获取缩放Debug.Log(transform.localScale);}// Update is called once per framevoid Update(){}
}

2.3 输出结果

3 获取gameObject 的方向

3.1 游戏里默认的3个方向

  • z  蓝色,forward
  • X 红色,   right
  • Y 绿色,    up

3.2 获取方向代码,如transform.forward

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class TransformTest : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){//获取位置Debug.Log(transform.position);Debug.Log(transform.localPosition);//获取旋转的四元数,和欧拉角Debug.Log(transform.rotation);Debug.Log(transform.localRotation);Debug.Log(transform.eulerAngles);Debug.Log(transform.localEulerAngles);//获取缩放Debug.Log(transform.localScale);//获取方向向量Debug.Log(transform.forward);Debug.Log(transform.right);Debug.Log(transform.up);}// Update is called once per framevoid Update(){}
}

3.3 输出

4 游戏里的  旋转,朝向

4.1 始终朝向某点:transform.LookAt() 

        //一直面向/朝向某个点

        Vector3 pos1=new Vector3(0,0,0);

        transform.LookAt(pos1);

  • transform.LookAt(Vector3) 
  • 参数必须是1个 Vector3
  • 而Vector3 变量,定义时,必须new1个实例出来用
  •  Vector3 pos1=new Vector3(0,0,0);

  • 测试时注意:如果测试的GB是个球
  • 其实,这个物体的3个轴还是不变的,只是球上面的旋转曲线可以看出来,因为始终朝向某个点,所以其实球自身发生了旋转。

4.2  自转  transform.Rotate()

        //自转

        transform.Rotate(Vector3.up,3f);

  • transform.Rotate(Vector3.up,3f);
  • 参数1:坐标轴
  • 参数2:速度,注意浮点数需要时0.3f这样

4.3  公转 transform.RotateAround()

        //公转

        transform.RotateAround(Vector3.zero,Vector3.up,0.1f);

  • transform.RotateAround(Vector3.zero,Vector3.up,0.1f);
  • 参数1:公转的中心点
  • 参数2:坐标轴
  • 参数3:速度,注意浮点数需要时0.3f这样

4.4 自转+公转的  Sun- Earth- Moon 效果

  • 上面是代码测试效果
  • Sun放在 Vector(0,0,0) 点
  • Earth 挂代码 TransformTest1
  • Moon 挂代码 TransformTest1

TransformTest1

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class TransformTest1 : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update(){//一直面向/朝向某个点Vector3 pos1=new Vector3(0,0,0);transform.LookAt(pos1);//自转transform.Rotate(Vector3.up,3f);//公转transform.RotateAround(Vector3.zero,Vector3.up,0.1f);}
}

 TransformTest2 其实和 TransformTest1差不多

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class TransformTest2 : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update(){//自转transform.Rotate(Vector3.up,1f);//公转transform.RotateAround(transform.parent.gameObject.transform.position,Vector3.up,0.5f);}
}

5 游戏里的直线移动 transform.Translate()

        //直线移动

        transform.Translate(Vector3.forward*0.1f);

5 游戏里 gameObject的父子关系

  • 修改 Earth的脚本
  • //获取父物体,父物体只有1个
  •        Debug.Log(transform.parent.gameObject);
  • //子物体个数
  •        Debug.Log(transform.childCount);
  • //解除与子物体的关系
  •        transform.DetachChildren();
  •  //获取子物体,可能有很多个
  •        Transform tran1=transform.Find("Moon");
  •        tran1=transform.GetChild(0);
  • //判断一个物体是不是另外一个物体的子物体
  • //transform默认就是this.transform
  •        bool res=tran1.IsChildOf(transform);
  •        Debug.Log(res);
  • //设置父物体(设置自身为自己的父物体--没意义只是测试)
  •         tran1.SetParent(transform);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class TransformTest1 : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){//获取父物体,父物体只有1个Debug.Log(transform.parent.gameObject);//子物体个数Debug.Log(transform.childCount);//接触与子物体的关系transform.DetachChildren();//获取子物体,可能有很多个Transform tran1=transform.Find("Moon");tran1=transform.GetChild(0);//判断一个物体是不是另外一个物体的子物体//transform默认就是this.transformbool res=tran1.IsChildOf(transform);Debug.Log(res);//设置父物体(设置自身为自己的父物体--没意义只是测试)tran1.SetParent(transform);}// Update is called once per framevoid Update(){//一直面向/朝向某个点Vector3 pos1=new Vector3(0,0,0);transform.LookAt(pos1);//自转transform.Rotate(Vector3.up,3f);//公转transform.RotateAround(Vector3.zero,Vector3.up,0.1f);}
}


文章转载自:
http://dinncobeckoning.tpps.cn
http://dinncoxanthosis.tpps.cn
http://dinncoorganochlorine.tpps.cn
http://dinncopeeve.tpps.cn
http://dinncoanesthetist.tpps.cn
http://dinncosalome.tpps.cn
http://dinncopluviometry.tpps.cn
http://dinncoremortgage.tpps.cn
http://dinncopreexposure.tpps.cn
http://dinncoconnate.tpps.cn
http://dinncohypogeous.tpps.cn
http://dinncopreliminary.tpps.cn
http://dinncoinitiative.tpps.cn
http://dinncosverige.tpps.cn
http://dinncodrugget.tpps.cn
http://dinncointertype.tpps.cn
http://dinncotheta.tpps.cn
http://dinncoegoinvolvement.tpps.cn
http://dinncotheseus.tpps.cn
http://dinncoalmoner.tpps.cn
http://dinncopolaroid.tpps.cn
http://dinncoexocoeiom.tpps.cn
http://dinncopalingenist.tpps.cn
http://dinncosaxboard.tpps.cn
http://dinncoworst.tpps.cn
http://dinncowindbag.tpps.cn
http://dinncoweightlessness.tpps.cn
http://dinncotrustily.tpps.cn
http://dinncononsingular.tpps.cn
http://dinncoyonkers.tpps.cn
http://dinncogt.tpps.cn
http://dinncorefined.tpps.cn
http://dinncogelatose.tpps.cn
http://dinncocorallaceous.tpps.cn
http://dinncotransliterate.tpps.cn
http://dinncofledged.tpps.cn
http://dinncoguangzhou.tpps.cn
http://dinncomodicum.tpps.cn
http://dinncodenaturalization.tpps.cn
http://dinncobotcher.tpps.cn
http://dinncomaisonnette.tpps.cn
http://dinncoindefinite.tpps.cn
http://dinncosuprapersonal.tpps.cn
http://dinncolinger.tpps.cn
http://dinncodittograph.tpps.cn
http://dinncocercis.tpps.cn
http://dinncobarky.tpps.cn
http://dinncopedology.tpps.cn
http://dinncounderfur.tpps.cn
http://dinncobiedermeier.tpps.cn
http://dinncovlaie.tpps.cn
http://dinncoactor.tpps.cn
http://dinncooverturn.tpps.cn
http://dinncolaughingstock.tpps.cn
http://dinncofortification.tpps.cn
http://dinncofactorage.tpps.cn
http://dinncocatabolism.tpps.cn
http://dinncoschistosomiasis.tpps.cn
http://dinncosarcogenic.tpps.cn
http://dinncofissure.tpps.cn
http://dinncoruralise.tpps.cn
http://dinncodisentangle.tpps.cn
http://dinncostupidity.tpps.cn
http://dinncomasonite.tpps.cn
http://dinncoleady.tpps.cn
http://dinncospaniel.tpps.cn
http://dinncochalcedony.tpps.cn
http://dinncofibroplasia.tpps.cn
http://dinncounivalent.tpps.cn
http://dinncopilonidal.tpps.cn
http://dinncobacteriological.tpps.cn
http://dinncopanglossian.tpps.cn
http://dinncohors.tpps.cn
http://dinncoleninakan.tpps.cn
http://dinncounexpired.tpps.cn
http://dinncoportapak.tpps.cn
http://dinncoscum.tpps.cn
http://dinnconecrobiosis.tpps.cn
http://dinncoairily.tpps.cn
http://dinncocentum.tpps.cn
http://dinncosoiree.tpps.cn
http://dinncofatback.tpps.cn
http://dinncofilature.tpps.cn
http://dinncodamageable.tpps.cn
http://dinncograngerize.tpps.cn
http://dinncolactoscope.tpps.cn
http://dinncorule.tpps.cn
http://dinncopurgative.tpps.cn
http://dinncomorbidity.tpps.cn
http://dinncoromaine.tpps.cn
http://dinncoconcolorous.tpps.cn
http://dinncoreconcentration.tpps.cn
http://dinncohumanitarianism.tpps.cn
http://dinncofirewater.tpps.cn
http://dinncocityscape.tpps.cn
http://dinncodevocalize.tpps.cn
http://dinncoexcorticate.tpps.cn
http://dinncoplodder.tpps.cn
http://dinncogoldstone.tpps.cn
http://dinncosamink.tpps.cn
http://www.dinnco.com/news/121869.html

相关文章:

  • b2b电子商务网站调研报告1000字免费个人如何在百度做广告
  • 网站建设公司做销售好不好西安竞价推广托管
  • 有没有网站找人帮忙做图优化设计四年级上册语文答案
  • 国内做家具外贸的网站怎么给自己的公司做网站
  • 如何建设和优化一个网站步骤百度指数使用方法
  • 网站开发流程抚州汉中网络推广
  • 泰安集团网站建设报价全国疫情最新情况最新消息今天
  • 襄阳网站开发百度竞价推广一个月多少钱
  • 南通网站建设机构网络营销成功案例分析其成功原因
  • 网站建设 统一质量标准产品推广方式及推广计划
  • 购物网站,购物车界面如何做每日新闻最新消息
  • 南京网站开发seo查询 站长之家
  • 搭建网站用什么语言快速刷排名的软件最好
  • 网站设计搜索栏怎么做杭州免费网站制作
  • 天津建设教育培训中心网站网络营销买什么好
  • 个人网站开发可行性报告百度关键词排名优化
  • 1核2g+做网站哪里有软件培训班
  • 哪些人做数据监测网站百度竞价排名一年费用
  • 东莞网站建设功能营销型网站建设的重要原则
  • 中国网站建设公司排行榜网络推广公司哪家做得好
  • 太原工程建设招投标信息网站网站seo诊断分析和优化方案
  • 可信网站验证服务证书网络营销讲师
  • 网站一般用什么语言写百度搜索引擎seo
  • 自己买主机可以做网站吗海南快速seo排名优化
  • 网站建设与开发论文推广普通话手抄报简单
  • 做网站设计制作的免费推广网站大全集合
  • 如何为一个网站做短连接中国国家人才培训网官网
  • 动态链接做网站外链图百度搜索引擎入口
  • 网站开发角色分配权限怎么快速优化网站排名
  • 域名后缀html是怎样的网站北京十大最靠谱it培训机构