[LayaAirIDE 2.0]子弹添加了colliderShape后onUpdate移动,destroy会报错“Cannot read property 'getWorldTransform' of null”

发射时生成子弹:
onFire() {
if (this.isFire) {
Laya.Mesh.load("fly2/fly3-bullet.lm", Laya.Handler.create(this, function (m) {
let bullet = new Laya.MeshSprite3D(m);
this.Sn.addChild(bullet);
bullet.addComponent(BulletScript);
var bulletCollider = bullet.addComponent(Laya.PhysicsCollider);
var bulletShape = new Laya.MeshColliderShape();
bulletShape.mesh = bullet.meshFilter.sharedMesh;
bulletCollider.colliderShape = bulletShape;
}))
}

 
子弹组件BulletScript中
onStart() {
Laya.timer.once(1500, this, function () {
console.log("destroy");
this.owner.destroy();
});
}
onUpdate() {
this.owner.transform.translate(new Laya.Vector3(0, 0, -0.1));
}
已邀请:

Sོ

赞同来自:

同问, 求解答

186*****880

赞同来自:

人工置顶~~~~~~

要回复问题请先

商务合作
商务合作