浏览代码

throw exception when using meshImpostor in compoundImpostor

Trevor Baron 6 年之前
父节点
当前提交
acaf094db1
共有 3 个文件被更改,包括 5 次插入2 次删除
  1. 1 1
      dist/preview release/what's new.md
  2. 1 1
      src/Debug/physicsViewer.ts
  3. 3 0
      src/Physics/Plugins/ammoJSPlugin.ts

+ 1 - 1
dist/preview release/what's new.md

@@ -218,7 +218,7 @@
 - AssetContainer should not dispose objects it doesn't contain. Support for environmentTexture add/remove ([TrevorDev](https://github.com/TrevorDev))
 - Fix `mesh.visibility` not working properly when certain material properties are set that changes the interpretation of alpha (e.g. refraction, specular over alpha, etc.) ([bghgary](https://github.com/bghgary))
 - Fix material and texture leak when loading/removing GLTF/obj/babylon files with AssetContainer ([TrevorDev](https://github.com/TrevorDev))
-- Avoid exception when removing impostor during cannon world step ([TrevorDev](https://github.com/TrevorDev))
+- Avoid exception when removing impostor during Cannon world step ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))

+ 1 - 1
src/Debug/physicsViewer.ts

@@ -261,7 +261,7 @@ export class PhysicsViewer {
                 break;
             case PhysicsImpostor.CylinderImpostor:
                 mesh = this._getDebugCylinderMesh(utilityLayerScene);
-                var bi = impostor.object.getBoundingInfo()
+                var bi = impostor.object.getBoundingInfo();
                 mesh.scaling.x = bi.boundingBox.maximum.x - bi.boundingBox.minimum.x;
                 mesh.scaling.y = bi.boundingBox.maximum.y - bi.boundingBox.minimum.y;
                 mesh.scaling.z = bi.boundingBox.maximum.z - bi.boundingBox.minimum.z;

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

@@ -856,6 +856,9 @@ export class AmmoJSPlugin implements IPhysicsEnginePlugin {
             meshChildren.forEach((childMesh) => {
                 var childImpostor = childMesh.getPhysicsImpostor();
                 if (childImpostor) {
+                    if (childImpostor.type == PhysicsImpostor.MeshImpostor) {
+                        throw "A child meshImpostor is not supported. Only primative impostors are supported as children (eg. box or sphere)";
+                    }
                     var shape = this._createShape(childImpostor);
 
                     // Position needs to be scaled based on parent's scaling