赞
踩
2D:
(1) 移动
this.GetComponent<RectTransform>().anchoredPosition += new Vector2(speed, 0);
(2)获取坐标值
PosX = this.GetComponent<RectTransform>().anchoredPosition.x;
PosY = this.GetComponent<RectTransform>().anchoredPosition.y;
(3)获取2D组件的大小和宽高
3D:
(1)移动
transform.localPosition += new Vector3(speed * Time.deltaTime, 0, 0); ----自身坐标
transform.position += new Vector3(speed * Time.deltaTime, 0, 0); ----世界坐标
问题:local与global、center与pivot之间的区别?
(2)获取坐标值
(3)获取3D模型的大小和长宽高
2D:
this.GetComponent<RectTransform>().eulerAngles += new Vector3(1,1, 0);
3D:
(1) this.transform.Rotate(Vector3.forward, speed * Time.deltaTime) ----Rotate
(2) this.transform.RotateAround(position, Vector3.right, speed); ----RotateAround
(3) this.transform.rotation *= Quaternion.Euler(speed , 0, 0); ----欧拉角
问题:欧拉角与四元数的区别与联系?
2D:
this.GetComponent<RectTransform>().localScale = new Vector3(1,1,1);
3D:
transform.localScale = new Vector3(1,1,1);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。