The code is producing the expected effect, as long as the mesh follows a straight line on the X axis.
What I would like to do is to twist around its center, a mesh that follows a path. Take the following picture as an example :
My guess is that, inside the vertex shader, I need to update the axis vec3 based on something but I’m lacking the mathematical knowledge to find out how and what…
I would appreciate any guidance on that matter.
Here’s a codesandbox link of what I have right now.
You can use the GUI pannel to “select” and move around the points that are forming the tube geometry. Notice that the shape will go bezerk as soon as you move one of the points.
I have managed to get the desired effect thanks to your suggestions @prisoner849 !
I have updated the original sandbox accordingly (link)
I can’t say that I understand the maths behind it yet, but hopefully I’ll get to it!
There is one line specifically that I stuggle to understand in your codepen. Could you maybe ellaborate?
uLengthRatio: {value: objSize.z / curve.cacheArcLengths[200]}, // more or less real lenght along the path