unity3d控制物体不出屏幕transform.position = new Vector3(Mathf.Clamp(this.width,Screen.width,0),0,0);transform.position = new Vector3(0,Mathf.Clamp(this.height,Screen.height,0),0);用来控制物体不出屏幕,把脚本赋给物体c#写的,

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 16:23:00
unity3d控制物体不出屏幕transform.position = new Vector3(Mathf.Clamp(this.width,Screen.width,0),0,0);transform.position = new Vector3(0,Mathf.Clamp(this.height,Screen.height,0),0);用来控制物体不出屏幕,把脚本赋给物体c#写的,

unity3d控制物体不出屏幕transform.position = new Vector3(Mathf.Clamp(this.width,Screen.width,0),0,0);transform.position = new Vector3(0,Mathf.Clamp(this.height,Screen.height,0),0);用来控制物体不出屏幕,把脚本赋给物体c#写的,
unity3d控制物体不出屏幕
transform.position = new Vector3(Mathf.Clamp(this.width,Screen.width,0),0,0);
transform.position = new Vector3(0,Mathf.Clamp(this.height,Screen.height,0),0);
用来控制物体不出屏幕,把脚本赋给物体
c#写的,老报错,为啥呀


unity3d控制物体不出屏幕transform.position = new Vector3(Mathf.Clamp(this.width,Screen.width,0),0,0);transform.position = new Vector3(0,Mathf.Clamp(this.height,Screen.height,0),0);用来控制物体不出屏幕,把脚本赋给物体c#写的,
没有 width 和 height 这个参数.你要自己设置物体的高宽变量,然后再算位置!