This is my first post on Unity Community, I’m probably over thinking this problem. Here is my code for the line renderer which is in Update(). It is in C#.
Here is the Unity script reference
if(Input.GetButton(“Fire1”))
{
line = GetComponent();
int i = 0;
Vector3 mousePosition = Input.mousePosition;
while (i < lengthOfLineRenderer)
{
Vector3 pos = new Vector3(i * 0.5F + player.position.x, Mathf.Sin(i + Time.time) + player.position.y, player.position.z);
line.SetPosition(i, pos);
i++;
line.SetColors(c1,c2);
}
}
It’s a 2d game, I have a feeling that I will need to actually rotate it keeping its local positions the same The sin function for its Y position is whats making this hard, if it were a straight line this would be cake for me.
If I could get this thing to rotate towards the mousePosition vector that would be awesome. Any help would be greatly appreciated. Thanks.