【问题标题】:How to remove the Ray effect when removing an object from a scene with THREE.js?使用 THREE.js 从场景中移除对象时如何移除光线效果?
【发布时间】:2012-11-13 21:48:01
【问题描述】:
function checkHit(bullet, b){

                for(var i = collidableMeshList.length-1 ; i>=0; i--){
                var collideMesh = collidableMeshList[i];
                var v = collideMesh.geometry.vertices[0];
            var c = collideMesh.position;
            var x = Math.abs(v.x), z = Math.abs(v.z);
                if(bullet.x < c.x + x && bullet.x > c.x - x && bullet.z < c.z + z && bullet.z > c.z - z){

                scene.remove(b); // Removing Bullet After Hitting
                 scene.remove(collideMesh); // Removing After hit By Bullet
                 delete collidableMeshList[index]; // deleting that Index on which the Mesh is Placed
                return true;
                }
                }

                return false;
            }

我想问一下如何从已删除和删除的地方删除射线效果或物体效果,因为即使我删除对象或将其从场景中删除,我也无法将我的汽车从该地方移动

【问题讨论】:

    标签: html webgl three.js


    【解决方案1】:

    这可以通过以下方式实现:

     renderer.deallocateObject( obj );
    

    或 obj.deallocate();

    这将完全擦除对象。 请阅读:https://github.com/mrdoob/three.js/issues/2621 干杯

    【讨论】:

      猜你喜欢
      • 2013-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-09
      • 1970-01-01
      • 1970-01-01
      • 2015-08-02
      • 2022-01-10
      相关资源
      最近更新 更多