【发布时间】:2019-09-10 08:50:06
【问题描述】:
我正在寻找一条包含箭头标记的线。如何用箭头显示它是一个问题。是否可以不使用线渲染器?
在此处附加一个链接以在屏幕上显示线条的绘制。Draw Arrow。如果我向右滑动箭头指向右侧并在屏幕上手持我可以更改箭头的位置。一旦我释放箭头位置是固定的。
我已经在两点之间画了一条线。代码如下。
if (Input.GetTouch(0).phase == TouchPhase.Began)
{
//--Clearing the list and adding first touch to list--
fingerPositions.Clear();
fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
Debug.Log("Made first touch");
click = true;
}
if (Input.GetTouch(0).phase == TouchPhase.Moved)
{
isSwiping = true;
}
if (Input.GetTouch(0).phase == TouchPhase.Ended && isSwiping == true)
{
//--Adding the last touch to the list--
fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
//currenline is GameObject
currenline = Instantiate(linePrefab, fingerPositions[0], Quaternion.identity);
getAllLines.Add(currenline);
//NewLine is a LineRenderer
NewLine = currenline.GetComponent<LineRenderer>();
Debug.Log("Finger count = "+fingerPositions.Count);
NewLine.SetPosition(0, fingerPositions[0]);
NewLine.SetPosition(1, fingerPositions[1]);
isSwiping = false;
}
【问题讨论】: