[LayaAir 1.0]3D物体检测到碰撞后,被碰撞物被移除的时候过30秒再次出现?并添加到舞台

两个方块,一个方块撞向另外一个,碰撞检测在运动的上面,检测到碰撞信息后删除对方。 PlayerMove.prototype.onTriggerStay = function (other)
{ this.tsizex = this.box._components[0]._transformOrientedBoundBox.extents.x;
this.tsizez = this.box._components[0]._transformOrientedBoundBox.extents.z;
this.osizex = other._transformOrientedBoundBox.extents.x;
this.osizez = other._transformOrientedBoundBox.extents.z;
//得到是否相交包含的数值:包围盒是否相交另一个包围盒
this.num1 = this.box._components[0].boundBox.containsOrientedBoundBox(other._transformOrientedBoundBox);
//得到是否相交包含的数值:包围盒是否包含另一个点
this.num2 = this.box._components[0].boundBox.containsPoint(other.owner.transform.position);
//空间中包围盒是否相交另一个包围盒
if(this.num1 == 2)
{
//空间中包围盒是否包含另一个点
if(this.num2 == 1)
{

if(this.tsizex > this.osizex && this.tsizez > this.osizez)
{
var eat = new Laya.Vector3(0, 0.5, 0);//龙卷风方法直接上升
other.owner.transform.translate(eat,true,false);
//0.1秒后删除
Laya.timer.once(100, null, Wipe);
function Wipe()
{
console.log(other._owner);
//移除自己
other._owner.removeSelf();
return;
}
}
else
{
var move1 = new Laya.Vector3(0.02, 0, 0);
var move2 = new Laya.Vector3(-0.02, 0, 0);
Laya.timer.once(0, null, Right);
Laya.timer.once(50, null, Left);
function Right()
{
other.owner.transform.translate(move1, true, false);
}
function Left()
{
other.owner.transform.translate(move2, true, false);
}
}
}

}

}
已邀请:

Aar0n

赞同来自:

发一段大代码是想表达什么?

下雨天

赞同来自:

Laya.timer.once(100, null, Wipe)时间管理器的执行域都没有,你怎么删除?

要回复问题请先

商务合作
商务合作