Three.js Line Mesh error

Hello everybody
I tried to add line mesh to my scene
But got error

@This is current codebase

let num = 10;

let curvePoints = ;

for (let i = 0; i < num; i++) {

let theta = (i / num) * Math.PI * 2;

curvePoints.push(new THREE.Vector3(Math.sin(theta), Math.cos(theta), Math.sin(theta * 3)));

}

const curve = new THREE.CatmullRomCurve3(curvePoints);

curve.tension = 0.7;

curve.closed = true;

const points = curve.getPoints(50);

const geometry = new THREE.BufferGeometry().setFromPoints(points);

const material = new THREE.LineBasicMaterial({ color: 0x00ffff });

const curveObject = new THREE.Line(curve, material);

console.log(curveObject);

scene.add(curveObject);

@Thre error message is here

Uncaught TypeError: Cannot read properties of undefined (reading ‘center’)
at Sphere.copy (three.module.js:5620:1)
at Frustum.intersectsObject (three.module.js:12575:1)
at projectObject (three.module.js:27114:1)
at projectObject (three.module.js:27159:1)
at WebGLRenderer.render (three.module.js:26951:1)
at render (index.js:66:14)
at eval (index.js:69:1)
at ./src/index.js (three-js-webpack-boilerplate-1.0.0da160b726bec7c94a1b.bundle.js:30:1)
at webpack_require (three-js-webpack-boilerplate-1.0.0da160b726bec7c94a1b.bundle.js:307:33)
at three-js-webpack-boilerplate-1.0.0da160b726bec7c94a1b.bundle.js:1353:37

current version is “three”: “0.139.2”

Try:

const curveObject = new THREE.Line(geometry, material);
1 Like