标签:
1 LineRenderer lineRender = this.renderer as LineRenderer; 2 //0代表起始点,这里是设置起始点position 3 lineRender.SetPosition (0,transform.position); 4 5 Ray ray = new Ray (transform.position,transform.forward); 6 RaycastHit hitInfo; 7 if(Physics.Raycast (ray, out hitInfo)) 8 { 9 //1代表终点,这里设置终点位置 10 lineRender.SetPosition(1,hitInfo.point); 11 } 12 else 13 { 14 lineRender.SetPosition(1,transform.position + transform.forward * 100); 15 }
标签:
原文地址:http://www.cnblogs.com/Akishimo/p/4756818.html