How can I make a tube and bend it in run time

Sorry for bother you guys but I am kind of bad in Math, I want to make like a tube and bend it using curve radius in a run time giving some inputs data like angle and distance.

Some one have an idea where and how to start?

Thanks.

Maybe these conversations can get you started in the right direction:


Also, I think @prisoner849 might be able to chime in with other good examples. :wink:

1 Like

Another option:
https://threejs.org/docs/index.html#api/en/objects/SkinnedMesh

1 Like

If it is a constant bending radius, or any other bending whose position and rotation offsets can be expressed in closed form, you can have a transform in the vertex shader that takes a straight, axis-aligned tube and transforms it to the desired bend, before applying the projectionMatrix*modelViewMatrix. Ideally, you will also find a way to transform normals. (I don’t know how to do that for any specific case, and certainly not for the general case.)

Maybe there’s something for you :question:


https://hofk.de/main/threejs/skeleton/03_skeleton.html
https://hofk.de/main/threejs/Hummel%20Mara/14_hummel_bumblebee.html
Comments unfortunately only in German, but easy to translate with deepl.com/translator ( I always take).


https://hofk.de/main/threejs/skeleton/00_skeletonBasic.html


https://hofk.de/main/threejs/sandboxthreef/formLibrary.html
to the addon see https://hofk.de/main/threejs/sandboxthreef/ and Addon. Produces almost infinite many time-varying geometries with functions