ソースを参照

creating cylinder fails when nativeOptions not specified

Trevor Baron 6 年 前
コミット
8e54af73fd
1 ファイル変更3 行追加0 行削除
  1. 3 0
      src/Physics/Plugins/cannonJSPlugin.ts

+ 3 - 0
src/Physics/Plugins/cannonJSPlugin.ts

@@ -271,6 +271,9 @@ export class CannonJSPlugin implements IPhysicsEnginePlugin {
             //TMP also for cylinder - TODO Cannon supports cylinder natively.
             case PhysicsImpostor.CylinderImpostor:
                 let nativeParams = impostor.getParam("nativeOptions");
+                if(!nativeParams){
+                    nativeParams = {};
+                }
                 let radiusTop = nativeParams.radiusTop !== undefined ? nativeParams.radiusTop : this._checkWithEpsilon(extendSize.x) / 2;
                 let radiusBottom = nativeParams.radiusBottom !== undefined ? nativeParams.radiusBottom : this._checkWithEpsilon(extendSize.x) / 2;
                 let height = nativeParams.height !== undefined ? nativeParams.height : this._checkWithEpsilon(extendSize.y) / 2;