unity获取和修改transform属性

得到修改面板的3个值
1.Position
get:
transform.position //Vector3
transform.position.x
transform.position.y
transform.position.z

xx = GameObject.Find("objName").GetComponent().position.x;
yy = GameObject.Find("objName").GetComponent().position.y;
zz = GameObject.Find("objName").GetComponent().position.z;


修改:
transform.position = new Vector3(x,y,z);
2.Rotation
get:
transform.localEulerAngles.x;
transform.localEulerAngles.y;
transform.localEulerAngles.z;
修改:
transform.localEulerAngles = new Vector3(x,y,z);
rotation = new Rotation(x,y,z,w);
 




3.Scale
get:
transform.localScale.x
transform.localScale.y
transform.localScale.z
修改:
transform.localScale = new Vector3(x,y,z)

你可能感兴趣的:(unity3d)