three.js销毁对象

var parent = brick.parent;
parent.remove(brick);
const children = brick.children;
if (!children) return;
children.forEach(({ geometry, material, children }) => {
    geometry.dispose();
    if (Array.isArray(material)) {
        material.forEach((m) => m.dispose());
    } else material?.dispose();
    if (children.length) children.forEach((item) => distoryObject(item, object));
});
posted @ 2024-09-20 09:34  暖暖De幸福  阅读(17)  评论(0编辑  收藏  举报