How to move the texture towards the other end of the line2D?

Hey All. I want to draw a guide line on the ground. In this playground, you can see that some places move in the opposite direction.
I think it has something to do with the setting of uvs. But I don’t know how to do it.

I think you’re right that UVs are definitely what’s at play here.

Have you considered trying to re-order the vertex points when you create each line segment? The order of the points could possibly affect this.

Adding @Cedric to help add some more guidance here.

1 Like

Hi @musk

I think there is a mismatch between the indices and the UVs. IMHO, it makes the code more complicated.
As the points are computed in the array along the path for the inner side, then the outter side, I would compute the UVs the same way, without using the indices.

The inner side has 0 for the V . the outter side has 1 for V.
Remains the U to compute. As an exercice, I just compute U based on index along the path.
It shows the U animation is well going in one direction.

2D Line in XZ plane with Width | Babylon.js Playground (