如何关闭 A 框架中 gltf 模型的视锥体剔除?我知道在 Three.js 中你可以遍历对象并添加 node.frustumCulled = false
。我试过了
AFRAME.registerComponent('disable-culling', {
init: function(){
var object3D = this.el.sceneEl.object3D;
object3D.traverse((node) => {
node.frustumCulled = false
})
}
})
但这不起作用。有人有什么主意吗?该实体是
<a-entity
id="ball"
scale="0.3 0.3 0.3"
position="0 0 -7"
gltf-model="#ballModel"
disable-culling
animation-mixer="clip: *; loop: once; clampWhenFinished: true;"
shadow>
</a-entity>
最佳答案
我有一个类似的问题,通过视锥体剔除解决了 -
el.addEventListener('model-loaded', () => {
const model = el.getObject3D('mesh');
model.traverse((node) => {
if (node.isMesh) {
node.frustumCulled = false;
}
});
});
我想知道您的解决方案不起作用是否只是因为模型尚未完成加载。
关于three.js - A 框架视锥体剔除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65791460/