# Three.js Line Mesh error

**URL:** <https://discourse.threejs.org/t/three-js-line-mesh-error/51750>\
**Category:** Questions\
**Created:** [May 18, 2023, 6:18pm UTC](https://discourse.threejs.org/t/three-js-line-mesh-error/51750 "2023-05-18T18:18:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cory](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/cory/32/33264_2.png) [@cory](https://discourse.threejs.org/u/cory)\
**Post date:** [May 18, 2023, 6:18pm UTC](https://discourse.threejs.org/t/three-js-line-mesh-error/51750/1 "2023-05-18T18:18:38Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [May 18, 2023, 7:05pm UTC](https://discourse.threejs.org/t/three-js-line-mesh-error/51750/2 "2023-05-18T19:05:34Z")

</div>

> [@cory](#):
>
> const curveObject = new THREE.Line(curve, material);

Try:

```javascript
const curveObject = new THREE.Line(geometry, material);

```
