标签:
int groundLayerIndex = LayerMask.GetMask (Tags.Ground); Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); RaycastHit hitInfo; if(Physics.Raycast (ray, out hitInfo, 200, groundLayerIndex)) { Vector3 target = hitInfo.point; target.y = transform.position.y; transform.LookAt(target); }
Ray ray = new Ray (transform.position,transform.forward); RaycastHit hitInfo; if(Physics.Raycast (ray, out hitInfo)) { lineRender.SetPosition(1,hitInfo.point); } else { lineRender.SetPosition(1,transform.position + transform.forward * 100); }
标签:
原文地址:http://www.cnblogs.com/Akishimo/p/4756795.html