Transform.lossyScale 有损缩放

var lossyScale : Vector3

Description描述

The global scale of the object (Read Only).

物体的全局缩放(只读)。

Please note that if you have a parent transform with scale and a child that is arbitrarily rotated, the scale will be skewed. Thus scale can not be represented correctly in a 3 component vector but only a 3x3 matrix. Such a representation is quite inconvenient to work with however. lossyScale is a convenience property that attempts to match the actual world scale as much as it can. If your objects are not skewed the value will be completely correct and most likely the value will not be very different if it contains skew too.

请注意日光你有一个有缩放的父物体变换和子物体有任意旋转的,缩放将有偏差。因此缩放不能正确的表示在3组件的向量,而是一个3x3矩阵。这样表示工作十分不方便,lossyScale是个很方便的属性,它尽量匹配实际世界缩放,如果你的物体不是有偏差的,这个值将是完全正确的,如果物体包含偏差,这个值也不会有很大的不同。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(transform.lossyScale);
	}
}
print (transform.lossyScale);
最后修改:2010年12月19日 Sunday 1:39

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。