[LayaAir 2.0]laya2 物理引擎好多问题

在拖动物体发生碰撞中,把mouseJoint关闭就报错?,但是第二次场景切换回来时,再次触发时,却没有报错?
onTriggerEnter(e:Laya.RigidBody):void{ 
var cil:Laya.CircleCollider=this.owner.getComponent(Laya.CircleCollider);
var rig:Laya.RigidBody=this.owner.getComponent(Laya.RigidBody);
cil.enabled=false;
rig.enabled=false;
var self:Laya.Sprite= this.owner as Laya.Sprite;
var ni:Laya.Animation=new Laya.Animation();
self.addChild(ni);
self.texture=null;
ni.source='baozha/baozha_0.png,baozha/baozha_1.png,baozha/baozha_2.png,baozha/baozha_3.png,baozha/baozha_4.png,baozha/baozha_5.png,baozha/baozha_6.png,baozha/baozha_7.png';
ni.interval=100;
ni.autoPlay=false;
ni.wrapMode=0;
ni.play(0,false); 
var man:Laya.Sprite= this.owner.parent.getChildByName('man') as Laya.Sprite;
var cil2:Laya.PolygonCollider=man.getComponent(Laya.PolygonCollider);
var rig2:Laya.RigidBody=man.getComponent(Laya.RigidBody);
var mou:Laya.MouseJoint=man.getComponent(Laya.MouseJoint);
var pri:Laya.PrismaticJoint=man.getComponent(Laya.PrismaticJoint);
pri.enabled=false;
mou.enabled=false;
cil2.enabled=false;
rig2.enabled=false;
 
var ni2:Laya.Animation= man.getChildByName('man_ani')as Laya.Animation;
// var ni2:Laya.Animation=new Laya.Animation();
// man.addChild(ni2);
ni2.source='man_die/man_1.png,man_die/man_2.png,man_die/man_3.png,man_die/man_4.png,man_die/man_5.png,man_die/man_6.png,man_die/man_7.png,man_die/man_8.png';
ni2.interval=100;
ni2.autoPlay=false;
ni2.wrapMode=0;
ni2.play(0,false);
// console.log('********'); 
Laya.timer.once(500,this,function(){
// Laya.Scene.load('start.json');
Laya.Scene.open('start.json');
})
 
已邀请:

要回复问题请先

商务合作
商务合作