- Home /
PDollars & Line renderer
Hello i am using PDollars (https://www.assetstore.unity3d.com/en/#!/content/21660) to detect my gesture on my game. I have a simple problem with the line renderer, on tactil, it makes a lot of points instead of a straight and soft line. It's obvously from this part of the code (you can see it in demo.cs):
if (drawArea.Contains(virtualKeyPosition))
{
if (Input.GetMouseButtonDown(0))
{
++strokeId;
Transform tmpGesture = Instantiate(gestureOnScreenPrefab, transform.position, transform.rotation) as Transform;
currentGestureLineRenderer = tmpGesture.GetComponent<LineRenderer>();
gestureLinesRenderer.Add(currentGestureLineRenderer);
vertexCount = 0;
}
if (Input.GetMouseButton(0))
{
points.Add(new Point(virtualKeyPosition.x, -virtualKeyPosition.y, strokeId));
currentGestureLineRenderer.SetVertexCount(++vertexCount);
currentGestureLineRenderer.SetPosition(vertexCount - 1, Camera.main.ScreenToWorldPoint(new Vector3(virtualKeyPosition.x, virtualKeyPosition.y, 10)));
}
}
The code use the points to make the line, but i can't find any solution. Some help would be greatly thanks.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612075430im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Vector direction to point 1 Answer
Help with LineRenderer 1 Answer