3
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;
            }

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

4

1 回答 1

1

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

 renderer.deallocateObject( obj );

或 obj.deallocate();

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

于 2012-11-27T21:00:01.580 回答