Create disconnected Tube Geomtery?

so using indices and stuff we can disconnect lines in a single geometry , is there any way to do this with tube geometry ?

one method is to use geomteryUtils merge option but i was wondering if there was a easier method ?

input curve is made using vector3 array passed to a catmulRom3 with tension 0 and i want disconnect at each corner to avoid the tube getting squished or to avoid using lots of segments

using multiple lineCurve3 in a curvePath does not seem work


    const vector1 = new THREE.Vector3(0, 0, 0)
    const vector2 = new THREE.Vector3(1, 0, 0)
    const LineCurve1 = new THREE.LineCurve3(vector1, vector2)

    const vector3 = new THREE.Vector3(0, 0, 0)
    const vector4 = new THREE.Vector3(0, 1, 0)
    const LineCurve2 = new THREE.LineCurve3(vector3, vector4)

    const vector5 = new THREE.Vector3(0, 0, 0)
    const vector6 = new THREE.Vector3(0, 0, 1)
    const LineCurve3 = new THREE.LineCurve3(vector5, vector6)

    const cPath = new THREE.CurvePath()
    cPath.add(LineCurve1)
    cPath.add(LineCurve2)
    cPath.add(LineCurve3)
    cPath.autoClose = false
   
    const tubeGeo = new THREE.TubeBufferGeometry(cPath, 1, 0.05, 8, false)

    const tubeMat = new THREE.MeshPhysicalMaterial({ color: 0xffff00, transmission: 1, roughness: 0 })
    const tubeMesh = new THREE.Mesh(tubeGeo, tubeMat)
    scene.add(tubeMesh)

It’s not possible to produce multiple “disconnected” tubes with a single instance of TubeGeometry. The path property should represent a continuous curve without gaps.

That is actually the way to go. So create multiple tubes and merge them to get a single geometry.

2 Likes