methusalah / SplineMesh

A Unity plugin to create curved content in real-time with bézier curves
https://twitter.com/dumas181
MIT License
1.05k stars 104 forks source link

fix: uv u coordinate follows the vertices #33

Closed sebjwallace closed 4 years ago

sebjwallace commented 4 years ago

If you create a new vertex the U coordinate is inherited from the selected vertex. The U is defined in the construction of the spline. Here the U coordinate is computed from the distance across the vertices, similar to how the V coordinate is computed from the spline distance.

SUV

methusalah commented 4 years ago

I can't see the point here.

V is computed automatically from the spline length and a scale because the texture is extruded along this axe, as well as the mesh.

U is set to a default value when a vertex is added to the 2D shape, then then you can set it to the value you need to fit your need. It all depends on the profile of the mesh you are extruding, and can't be automated.

In addition, in the code you propose, you seem to set all U coordinates to a regular interval between points with the line u = (1f / shapeVertices.Count) * i;, using only indices and not the distances between points.

Can you give more details about what you are trying to acheive here?