02a936f419f16298235d505e723651856af54c32 1.1 KB

12345
  1. {
  2. "code": "export default class Car extends Laya.Script3D {\r\n onAwake() {\r\n this.selfobj = this.owner;\r\n this.tran = this.selfobj.transform;\r\n this.rigs = this.selfobj.getChildByName(\"Rigs\");\r\n this.combincollider = new Laya.CompoundColliderShape();\r\n }\r\n Reset() {\r\n }\r\n CreateRigs() {\r\n if (this.rig)\r\n return;\r\n this.rig = this.selfobj.addComponent(Laya.Rigidbody3D);\r\n this.rig.isKinematic = true;\r\n this.rig.restitution = 0;\r\n for (let index = 0; index < this.rigs.numChildren; index++) {\r\n const element = this.rigs.getChildAt(index);\r\n let radiu = element.transform;\r\n let sharp = new Laya.SphereColliderShape(radiu.localScaleX >> 1);\r\n this.combincollider.addChildShape(sharp);\r\n sharp.localOffset = element.transform.localPosition;\r\n }\r\n this.rig.colliderShape = this.combincollider;\r\n this.rig.isKinematic = false;\r\n }\r\n onDestroy() {\r\n if (this.rig)\r\n this.rig.destroy();\r\n }\r\n}\r\n",
  3. "references": []
  4. }