소스 검색

Fixing instanced meshes and worker collisions

The mesh is added to the scene before the source mesh was even set (and
is updated later). Without checking if the sourceMesh exists, it would
throw an exception at the first call of the constructor and will prevent
worker collisions to work with instances.
Raanan Weber 10 년 전
부모
커밋
eb43d187ab
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      src/Collisions/babylon.collisionCoordinator.js
  2. 1 1
      src/Collisions/babylon.collisionCoordinator.ts

+ 1 - 1
src/Collisions/babylon.collisionCoordinator.js

@@ -180,7 +180,7 @@ var BABYLON;
                 geometryId = mesh.geometry ? mesh.geometry.id : null;
             }
             else if (mesh instanceof BABYLON.InstancedMesh) {
-                geometryId = mesh.sourceMesh.geometry ? mesh.sourceMesh.geometry.id : null;
+                geometryId = (mesh.sourceMesh && mesh.sourceMesh.geometry) ? mesh.sourceMesh.geometry.id : null;
             }
             return {
                 uniqueId: mesh.uniqueId,

+ 1 - 1
src/Collisions/babylon.collisionCoordinator.ts

@@ -158,7 +158,7 @@ module BABYLON {
             if (mesh instanceof Mesh) {
                 geometryId = (<Mesh>mesh).geometry ? (<Mesh>mesh).geometry.id : null;
             } else if (mesh instanceof InstancedMesh) {
-                geometryId = (<InstancedMesh>mesh).sourceMesh.geometry ? (<InstancedMesh>mesh).sourceMesh.geometry.id : null;
+                geometryId = ((<InstancedMesh>mesh).sourceMesh && (<InstancedMesh>mesh).sourceMesh.geometry) ? (<InstancedMesh>mesh).sourceMesh.geometry.id : null;
             }
 
             return {