Ver código fonte

use cylinder mesh, fix typo

Trevor Baron 6 anos atrás
pai
commit
b6cf78161f
2 arquivos alterados com 11 adições e 7 exclusões
  1. 10 6
      src/Debug/physicsViewer.ts
  2. 1 1
      src/Physics/Plugins/ammoJSPlugin.ts

+ 10 - 6
src/Debug/physicsViewer.ts

@@ -33,6 +33,7 @@ export class PhysicsViewer {
 
 
     private _debugBoxMesh: Mesh;
     private _debugBoxMesh: Mesh;
     private _debugSphereMesh: Mesh;
     private _debugSphereMesh: Mesh;
+    private _debugCylinderMesh: Mesh;
     private _debugMaterial: StandardMaterial;
     private _debugMaterial: StandardMaterial;
     private _debugMeshMeshes = new Array<Mesh>();
     private _debugMeshMeshes = new Array<Mesh>();
 
 
@@ -198,14 +199,14 @@ export class PhysicsViewer {
     }
     }
 
 
     private _getDebugCylinderMesh(scene: Scene): AbstractMesh {
     private _getDebugCylinderMesh(scene: Scene): AbstractMesh {
-        if (!this._debugSphereMesh) {
-            this._debugSphereMesh = CylinderBuilder.CreateCylinder('physicsBodyCylinderViewMesh', { diameterTop: 1, diameterBottom: 1, height: 1 }, scene);
-            this._debugSphereMesh.rotationQuaternion = Quaternion.Identity();
-            this._debugSphereMesh.material = this._getDebugMaterial(scene);
-            this._debugSphereMesh.setEnabled(false);
+        if (!this._debugCylinderMesh) {
+            this._debugCylinderMesh = CylinderBuilder.CreateCylinder('physicsBodyCylinderViewMesh', { diameterTop: 1, diameterBottom: 1, height: 1 }, scene);
+            this._debugCylinderMesh.rotationQuaternion = Quaternion.Identity();
+            this._debugCylinderMesh.material = this._getDebugMaterial(scene);
+            this._debugCylinderMesh.setEnabled(false);
         }
         }
 
 
-        return this._debugSphereMesh.createInstance('physicsBodyBoxViewInstance');
+        return this._debugCylinderMesh.createInstance('physicsBodyBoxViewInstance');
     }
     }
 
 
     private _getDebugMeshMesh(mesh: Mesh, scene: Scene): AbstractMesh {
     private _getDebugMeshMesh(mesh: Mesh, scene: Scene): AbstractMesh {
@@ -283,6 +284,9 @@ export class PhysicsViewer {
         if (this._debugSphereMesh) {
         if (this._debugSphereMesh) {
             this._debugSphereMesh.dispose();
             this._debugSphereMesh.dispose();
         }
         }
+        if (this._debugCylinderMesh) {
+            this._debugCylinderMesh.dispose();
+        }
         if (this._debugMaterial) {
         if (this._debugMaterial) {
             this._debugMaterial.dispose();
             this._debugMaterial.dispose();
         }
         }

+ 1 - 1
src/Physics/Plugins/ammoJSPlugin.ts

@@ -857,7 +857,7 @@ export class AmmoJSPlugin implements IPhysicsEnginePlugin {
                 var childImpostor = childMesh.getPhysicsImpostor();
                 var childImpostor = childMesh.getPhysicsImpostor();
                 if (childImpostor) {
                 if (childImpostor) {
                     if (childImpostor.type == PhysicsImpostor.MeshImpostor) {
                     if (childImpostor.type == PhysicsImpostor.MeshImpostor) {
-                        throw "A child meshImpostor is not supported. Only primative impostors are supported as children (eg. box or sphere)";
+                        throw "A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)";
                     }
                     }
                     var shape = this._createShape(childImpostor);
                     var shape = this._createShape(childImpostor);