I executed below code for checking LineRenderer behavior in Unity 5.5.0b2.
using UnityEngine;
using UnityEngine.Rendering;
public class MainController : MonoBehaviour
{
private LineRenderer _line;
void Start ()
{
_line = gameObject.AddComponent<LineRenderer>();
_line.shadowCastingMode = ShadowCastingMode.Off;
_line.receiveShadows = false;
var mat = new Material(Shader.Find("VR/SpatialMapping/Wireframe"));
_line.sharedMaterial = mat;
float width = 0.5f;
_line.startWidth = width;
_line.endWidth = width;
_line.SetVertexCount(3);
_line.numCapVertices = 0;
_line.numCornerVertices = 0;
}
void Update ()
{
// Loop1();
// Loop2();
Loop3();
}
void Loop1()
{
float v = Mathf.Sin(Time.time);
_line.SetPosition(0, new Vector3(-1, 0, 0));
_line.SetPosition(1, new Vector3(0, v, 0));
_line.SetPosition(2, new Vector3(1, 0, 0));
}
void Loop2()
{
float v = Mathf.Sin(Time.time);
_line.SetPosition(0, new Vector3(-1 + v, -1, 0));
_line.SetPosition(1, new Vector3(0, 1, 0));
_line.SetPosition(2, new Vector3(1 - v, -1, 0));
}
void Loop3()
{
float v = Mathf.Sin(Time.time);
_line.SetPosition(0, new Vector3(-1 , -1, 0));
_line.SetPosition(1, new Vector3(0, 1, 0));
_line.SetPosition(2, new Vector3(1 - v*2.5f, -1, 0));
}
}
In the case of Loop1(), the result is attached 1.gif
.
Center corner moves jerkily.
In the case of Loop2(), the result is attached 2.gif
.
Though the center point is fixed in code, but it moving. I think it should not move.
In the case of Loop3(), the result is attached 3.gif
.
Right arm transforms from rectangle to triangle suddenly. I think it should not transform triangle.