admin管理员组

文章数量:1611925

//获取对象Transform组件下的position

float xx;//可设默认值

float yy;

float zz;

xx = GameObject.Find("objName").GetComponent<Transform>().position.x;

yy = GameObject.Find("objName").GetComponent<Transform>().position.y;

zz = GameObject.Find("objName").GetComponent<Transform>().position.z;

//设置对象Transform组件下的position

GameObject.Find ("objName").GetComponent<Transform>().position = new Vector3(xx,yy,zz);

//获取对象Transform 组件下的 rotation

float rx;

float ry;

float rz;

rx = GameObject.Find ("objName").GetComponent<Transform> ().localEulerAngles.x;

ry = GameObject.Find ("objName").GetComponent<Transform> ().localEulerAngles.y;

rz = GameObject.Find ("objName").GetComponent<Transform> ().localEulerAngles.z;

//设置对象Transform组件下的 r

本文标签: 物体板上对象UnityRotation