示例代码如下:
[code]
this.capsule = new Laya.MeshSprite3D(new Laya.CapsuleMesh(0.5, 1));
var capsuleCollider:Laya.PhysicsCollider = this.capsule.addComponent(Laya.PhysicsCollider);//网格触发器
var capsuleShape:Laya.CapsuleColliderShape = new Laya.CapsuleColliderShape(0.5,1);
capsuleCollider.colliderShape = null;
capsuleCollider.isTrigger = true;
var sphereRigid:Laya.Rigidbody3D = this.capsule.addComponent(Laya.Rigidbody3D);
//将碰撞盒添加到刚体上
sphereRigid.colliderShape = capsuleShape;
this.capsule.destroy()[/code]调用destroy就会报错