API

Class SolidParticle

Represents one particle of a solid particle system.

Index
  • Creates a Solid Particle object. Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()

    Parameters

    • particleIndex: number

      (integer) is the particle index in the Solid Particle System pool.

    • particleId: number

      (integer) is the particle identifier. Unless some particles are removed from the SPS, it's the same value than the particle idx.

    • positionIndex: number

      (integer) is the starting index of the particle vertices in the SPS "positions" array.

    • indiceIndex: number

      (integer) is the starting index of the particle indices in the SPS "indices" array.

    • model: Nullable<ModelShape>

      (ModelShape) is a reference to the model shape on what the particle is designed.

    • shapeId: number

      (integer) is the model shape identifier in the SPS.

    • idxInShape: number

      (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))

    • sps: SolidParticleSystem

      defines the sps it is associated to

    • modelBoundingInfo: Nullable<BoundingInfo> = null

      is the reference to the model BoundingInfo used for intersection computations.

    • materialIndex: Nullable<number> = null

      is the particle material identifier (integer) when the MultiMaterials are enabled in the SPS.

    Returns SolidParticle

age: number = 0

The current age of the particle.

alive: boolean = true

Is the particle active or not ?

color: Nullable<Color4> = ...

The color of the particle

cullingStrategy: number = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY

The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum(). The possible values are :

  • AbstractMesh.CULLINGSTRATEGY_STANDARD
  • AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY
  • AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION
  • AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY Please read each static variable documentation in the class AbstractMesh to get details about the culling process.
id: number = 0

particle identifier

idx: number = 0

particle global index

idxInShape: number = 0

Index of the particle in its shape id

isVisible: boolean = true

Is the particle visible or not ?

lifeTime: number = Infinity

Defines how long will the life of the particle be. Set to Infinity for particles that should never die (default behavior for SolidParticleSystem).

materialIndex: Nullable<number> = null

The particle material identifier (integer) when MultiMaterials are enabled in the SPS.

parentId: Nullable<number> = null

Parent particle Id, if any. Default null.

pivot: Vector3 = ...

The pivot point in the particle local space.

position: Vector3 = ...

The world space position of the particle.

props: any = null

Custom object or properties.

rotation: Vector3 = ...

The world space rotation of the particle. (Not use if rotationQuaternion is set)

rotationQuaternion: Nullable<Quaternion>

The world space rotation quaternion of the particle.

scaling: Vector3 = ...

The scaling of the particle.

shapeId: number = 0

ModelShape id of this particle

translateFromPivot: boolean = false

Must the particle be translated from its pivot point in its local space ? In this case, the pivot point is set at the origin of the particle local space and the particle is translated. Default : false

uvs: Vector4 = ...

The uvs of the particle.

velocity: Vector3 = ...

The current speed of the particle.

  • Returns a boolean. True if the particle intersects another particle or another mesh, else false. The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)

    Parameters

    • target: Mesh | SolidParticle

      is the object (solid particle or mesh) what the intersection is computed against.

    Returns boolean

    true if it intersects

  • Returns true if the solid particle is within the frustum defined by the passed array of planes. A particle is in the frustum if its bounding box intersects the frustum

    Parameters

    • frustumPlanes: Plane[]

      defines the frustum to test

    Returns boolean

    true if the particle is in the frustum planes