如果一个点在摄像机视图之外,则Three.js线消失 [英] Three.js line disappears if one point is outside of the camera's view

查看:503
本文介绍了如果一个点在摄像机视图之外,则Three.js线消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照文档中的说明创建了一行:
http:// threejs .org / docs / #Reference / Objects / Line



但是当其中一个线点位于相机视图之外时,线条会消失。 / p>

我还尝试使用 https:// github。 com / spite / THREE.MeshLine ,但我仍有同样的问题。



我该如何解决?

解决方案

如果更新线的顶点,还必须更新线的边界球体,以便截头锥体剔除才能正常工作。

  line.geometry.computeBoundingSphere(); 

或者,您可以通过设置


$来防止对您的行进行视锥问题剔除b $ b

  line.frustumCulled = false; 

three.js r.75


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?

解决方案

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

这篇关于如果一个点在摄像机视图之外,则Three.js线消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆