瀏覽代碼

Merge pull request #5610 from barroij/LineIdInPicking

Returns line index when the pickedMesh is a LinesMesh
David Catuhe 6 年之前
父節點
當前提交
578c47925f
共有 3 個文件被更改,包括 3 次插入2 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 1 1
      src/Collisions/babylon.pickingInfo.ts
  3. 1 1
      src/Mesh/babylon.subMesh.ts

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

@@ -138,6 +138,7 @@
 - Fixed inspector dynamic loading ([Sebavan](https://github.com/Sebavan))
 - Fixed infiniteDistance not working anymore ([Sebavan](https://github.com/Sebavan))
 - Fixed bug in SolidParticle BoundingSphere update within the SolidParticleSystem ([barroij](https://github.com/barroij))
+- Update Picking so that when the picked Mesh is a LinesMesh, the index of the picked line is returned in the `faceId` property of the `PickingInfo`, as we do with face index the picked Mesh is made of triangle faces ([barroij](https://github.com/barroij))
 
 ### Viewer
 

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

@@ -38,7 +38,7 @@ module BABYLON {
         public bu = 0;
         /** (See getTextureCoordinates) The barycentric V coordinate that is used when calulating the texture coordinates of the collision.*/
         public bv = 0;
-        /** The id of the face on the mesh that was picked  */
+        /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */
         public faceId = -1;
         /** Id of the the submesh that was picked */
         public subMeshId = 0;

+ 1 - 1
src/Mesh/babylon.subMesh.ts

@@ -368,7 +368,7 @@ module BABYLON {
 
                 if (fastCheck || !intersectInfo || length < intersectInfo.distance) {
                     intersectInfo = new IntersectionInfo(null, null, length);
-
+                    intersectInfo.faceId = index / 2;
                     if (fastCheck) {
                         break;
                     }