Tube Geometry with width

Hello everyone, I hope you have a nice day.

I would like to generate the tube which has its own width.
To use TubeGeometry or CylinderGeometry in three.js the width is zero.
And if it’s possible, can I draw it in Cannon.js too?
So, please help me.

It’s not clear what you’re asking, TubeGeometry has a radius parameter you can pass in on its creation… Is this what you’re referring to as “width”?

Hi @Lawrence3DPK, thank you for your help.

Sharing this image for the reference…

Both of the links you’ve shared return a malformed url request, any chance you can just paste the images in this thread?

Sorry, I forgot to set the permission. :smile:
Please check it again

Nope, it’s a still a malformed 404.

I tried to upload an image here, but it didn’t go through.

Please check it again.

Let me try:

image image

1 Like

As an option, you can use THREE.Shape of absarc with a circular hole, and pass it in THREE.ExtrudeGeometry

Demo: https://codepen.io/prisoner849/full/WNaGowN

4 Likes

Thank you @prisoner849, it works well

And can I draw this shape even in Cannon.js?

@prisoner849 is it possible to control the thickness of this tube with a slider using the GUI? I am hoping to create a simple tube like this (but straight) where a user can control the size of the inner and outer diameter.

Thanks!

You can but you wont be able to use a dynamic collider with it… but it could work as a static collider.

Rebuild mesh’s geometry by extruding a shape with new parameters? :thinking:

1 Like

I’d propose morphing between the outer surface and the central path along the tube. Better performance at the cost of more data.

1 Like