How can I add a repeating “arrow” texture to a Vectrosity line?
I’m writing a game which includes a 2D map at the bottom of the screen. As the player advances, they place waypoints. The map shows these waypoints connected by lines. When I draw Vectrosity lines using a material without a texture, they look good (crisp lines with a reasonable thickness). I want to add an arrow texture to the line but I can’t get the thickness of the line, the size of the texture and the scaling right.
I’ve created a 200x50 pixel PNG texture which is a line with an arrow in the middle. Here’s what happens with various parameters.
- No texture, line width 5: looks nice.
- Texture, line width 5: too thin.
- Texture, line width 50: looks nice if the line length is reasonable but texture is stretched if line is very long.
- Texture, line width 50, SetTextureScale(1): only one arrow at the end of each line segment, line slightly blurry and arrow stretched (the arrow is less ‘pointy’), some parts of the texture disappear from time to time.
So what size should I make my texture? How thick should I set the line? Why won’t SetTextureScale(1) make my arrow repeat at regular intervals?
My code looks roughly like this:
VectorLine line = new VectorLine("path", waypoints, pathMaterial, width, LineType.Continuous);
Vector.SetTextureScale(line, 1f);
Vector.DrawLine3D(line);
Actually, I update the lines dynamically by modifying line.points3, line.maxDrawIndex, and calling SetTextureScale() and DrawLine3D() every time. Possibly this is affecting the way they look but I hope not.
Any help appreciated.