Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three.js line disappears if one point is outside of the camera's view

I created a line as explained in the docs: http://threejs.org/docs/#Reference/Objects/Line.

But when one of the line points is outside of the camera's view, the line disappears.

I also tried to use https://github.com/spite/THREE.MeshLine, but I still have the same problem.

How can I fix it?

like image 216
Николаев Сергей Avatar asked Apr 08 '16 10:04

Николаев Сергей


1 Answers

If you update the vertices of your line, you must also update the bounding sphere of your line for frustum culling to work correctly.

line.geometry.computeBoundingSphere();

Alternatively, you can prevent frustum culling of your line by setting

line.frustumCulled = false;

three.js r.75

like image 65
WestLangley Avatar answered Oct 03 '22 14:10

WestLangley