看了大佬们的各种贝塞尔曲线都没看懂
来自渣渣的反思
public LineRenderer lr;public int a = 0;List<Vector3> posList = new List<Vector3>();public Material mat1;void Start(){lr.material = mat1;lr.alignment = LineAlignment.View;}void Update(){if (Input.GetKey(KeyCode.Mouse0)){Ray ray = Camera.main.usePosition);RaycastHit hit;if (Physics.Raycast(ray, out hit)){//碰到地板planeif (llider.tag == "Plane")){posList.Add(hit.point);lr.positionCount = posList.Count;lr.SetPositions(posList.ToArray());}}}}
现在的线不平滑,有的地方还会没了
百度上找了3天,mmp
还没找到答案
最后发现线的y轴有变化,导致了线不平滑
posList.Add(hit.point.x,0, hit.point.z);
赋值y的时候直接0就搞定
本文发布于:2024-01-30 14:06:41,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170659480520536.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |