cory
April 18, 2023, 6:32pm
1
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”?
cory
April 18, 2023, 6:57pm
3
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?
cory
April 18, 2023, 7:20pm
5
Sorry, I forgot to set the permission.
Please check it again
Nope, it’s a still a malformed 404.
cory
April 18, 2023, 7:25pm
7
I tried to upload an image here, but it didn’t go through.
Please check it again.
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
cory
April 18, 2023, 7:59pm
10
Thank you @prisoner849 , it works well
cory
April 18, 2023, 8:00pm
11
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?
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