作业帮 > 综合 > 作业

unity3d控制物体不出屏幕

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/10/09 02:27:19
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控制物体不出屏幕
没有 width 和 height 这个参数.你要自己设置物体的高宽变量,然后再算位置!