【Unity】入门学习笔记180524——API(18)——Transform类功能注解

1、关于localScale和lossyScale的功能注解

使用不当往往会使得GameObject对象产生错误的变形

①当GameObject对象A为GameObject对象B的父物体时,父物体A的各个分量放缩值x、y、z的大小应保持1:1:1的比例,否则当子物体B的Rotation值比例不为1:1:1时,B物体将会发生变形。

②设GameObject对象A为B的父物体,当A物体各个分量的放缩值保持1:1:1的比例时,子物体B的lossyScale返回值即为B物体相对世界坐标系的放缩值,关系为

B.localScale=B.lossyScale/A.localScale


2、关于Transform类中涉及空间变换的几个属性和方法的功能注解

在Transform类中涉及空间变换的几个属性和方法主要有:

worldToLocalMatrix、localToWorldMatrix、TransformPoint、InverseTransformPoint

TransformDirection、InverseTransformDirection

其中,

#worldToLocalMatrix、localToWorldMatrix属于Transform类的只读属性

#利用worldToLocalMatrix和localToWorldMatrix的返回值可以实现与方法TransformPoint和

InverseTransformPoint类似的功能

#worldToLocalMatrix、localToWorldMatrix、TransformPoint、InverseTransformPoint在空间转换方式上相似,都会受到局部坐标系即transform自身坐标系的位置和放缩值得影响,而方法TransformDirection、InverseTransformDirection在空间转换方式上相似,它们不会受到局部坐标系即transform自身坐标系得位置和放缩值得影响。

#这几个方法或属性在空间转换时都会受到局部坐标系即transform自身坐标系中Rotation的影响,但他们各自的受影响方式不同。


//具体使用时再深入研究

TransformPoint:

InverseTransformPoint:

TransformDirection:

InverseTransformDirection:





猜你喜欢

转载自blog.csdn.net/dylan_day/article/details/80435362
今日推荐