您好我有一个collada文件并加载它。 第1步:加载collada:
loader = new THREE.ColladaLoader(manager);
loader.options.convertUpAxis = true;
loader.load("/collada/monster.dae",
function (collada) {
android = collada.scene;
skin = collada.skins[0];
android.scale.set(1, 1, 1);
});
第2步:克隆collada并添加eventcontrol以删除对象
var eventControl = initEventsControls();
cloneMonster = android.clone();
cloneMonster .position.set(100, 0, 100);
eventControl.attach( cloneMonster );
scene.add(cloneMonster );
步骤3:在initEventsControls()函数上单击
删除对象function initEventsControls() {
var eventControls = new EventsControls(camera, renderer.domElement);
eventControls.map = plane;
eventControls.attachEvent('mouseOver', function () {
this.container.style.cursor = 'pointer';
});
eventControls.attachEvent('mouseOut', function () {
this.container.style.cursor = 'auto';
});
eventControls.attachEvent('onClick', function () {
this.intersects[ 0 ].object.remove();
});
var Scale = new THREE.Vector3(10, 10, 10);
eventControls.scale.copy(Scale);
eventControls.offsetUse = true;
return eventControls;
}
但是当我点击对象时它不会删除对象。
如何删除克隆的collada对象?