فهرست منبع

Added new helper method to abstract mesh class (#8342)

PirateJC 5 سال پیش
والد
کامیت
7d493809c9
2فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 1 0
      dist/preview release/what's new.md
  2. 9 0
      src/Meshes/abstractMesh.ts

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

@@ -37,6 +37,7 @@
 - Change default camera calculations to only include visible and enabled meshes ([bghgary](https://github.com/bghgary))
 - Optimized frozen instances ([Deltakosh](https://github.com/deltakosh))
 - Add support for detail maps in both the standard and PBR materials ([Popov72](https://github.com/Popov72))
+- Added abstractMesh method to get all particle systems that use the mesh as an emitter ([PirateJC](https://github.com/PirateJC))
 
 ### NME
 

+ 9 - 0
src/Meshes/abstractMesh.ts

@@ -29,6 +29,7 @@ import { Color3, Color4 } from '../Maths/math.color';
 import { Epsilon } from '../Maths/math.constants';
 import { Plane } from '../Maths/math.plane';
 import { Axis } from '../Maths/math.axis';
+import { IParticleSystem } from '../Particles/IParticleSystem';
 
 declare type Ray = import("../Culling/ray").Ray;
 declare type Collider = import("../Collisions/collider").Collider;
@@ -2176,4 +2177,12 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         throw _DevTools.WarnImport("EdgesRenderer");
     }
 
+    /**
+     * This function returns all of the particle systems in the scene that use the mesh as an emitter.
+     * @returns an array of particle systems in the scene that use the mesh as an emitter
+     */
+    public getConnectedParticleSystems(): IParticleSystem[] {
+        return this._scene.particleSystems.filter((particleSystem) => particleSystem.emitter === this);
+    }
+
 }