Reputation: 534
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;
}
I want to ask that how to remove the Ray effect or object effect from that deleted and removed place as i am not able to move my car from the place even if I delete the object or remove it from the scene
Upvotes: 3
Views: 363
Reputation: 181
This can be achieved by:
renderer.deallocateObject( obj );
or obj.deallocate();
This will completely erase the object. Please read this: https://github.com/mrdoob/three.js/issues/2621 Cheers
Upvotes: 1