TubeGeometry: Problems with "path" parameter

Hi,

Still part of the latest threejs versions? If not, what else to use instead?

Thanks

Hi!
Yes, `THREE.TubeGeometry()`/`THREE.TubeBufferGeometry()` are in the core of three.js.

Ok, then I´m doing it possibly wrong:

``````var path = [ new THREE.Vector3(-1, 1, 0),
new THREE.Vector3(-1, 1.2, 0),
new THREE.Vector3(0, 0, 0.5),
new THREE.Vector3(1, 1.2, 0),
new THREE.Vector3(1, 1, 0)
]

var tgeometry = new THREE.TubeGeometry( /*vec["_" + 7 + "_"]*/path, 20, 2, 8, false );
var tmaterial = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
var tmesh = new THREE.Mesh( tgeometry, tmaterial );
``````

Console throws following error:
three.js:26178 Uncaught TypeError: path.computeFrenetFrames is not a function
at new TubeBufferGeometry (three.js:26178)
at new TubeGeometry (three.js:26139)

`path` is not just a set of points.

The documentation says:

TubeGeometry(path : Curve, tubularSegments : Integer, radius : Float, radialSegments : Integer, closed : Boolean)

path — Curve - A path that inherits from the Curve base class
tubularSegments — Integer - The number of segments that make up the tube, default is 64
radius — Float - The radius of the tube, default is 1
radialSegments — Integer - The number of segments that make up the cross-section, default is 8
closed — Boolean Is the tube open or closed, default is false

And at this point I´m “pretty goldfish” about what to do…

Ok, got it…

``````var path = [ new THREE.Vector3(-1, 1, 0),
new THREE.Vector3(-1, 1.2, 0),
new THREE.Vector3(0, 0, 0.5),
new THREE.Vector3(1, 1.2, 0),
new THREE.Vector3(1, 1, 0)
]
var pathBase = new THREE.CatmullRomCurve3(path);
``````

does the job…

1 Like