Hi,
I’m storing an vector2 array of 20 to store last 20 positions of my bullet. Then I shift back elements and put the latest position to the 20th position in array.
for (int i = lastPositions.Length - 1; i > 1; --i)
{
lastPositions[i - 1] = lastPositions*;*
}
Then I call my LineRenderer component, call SetVertexCount to 20 and then call SetPosition and pass the positions to it (Note that I’m passing Vector2 positions instead of Vector3):
for (int i = 0; i < TrailLength; ++i)
{
GetComponent().SetPosition(i, lastPositions*);*
}
But it won’t work correctly. I’ve tried enabling and disabling “Use World Space” (Even though I’m not sure what it means), but it didn’t help.
What am I missing here?
Thanks.