Particle system not scaling based on parent objects - emitter is a mesh that is a child of a scaled parent

Particles do not scale in relation to their parented meshes.

I have the following hierarchy: Sphere -> Cube

var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
box = BABYLON.MeshBuilder.CreateBox("box", {size: 0.5}, scene)

The particle system has it emitter set as the Cube.

var particleSystem = new BABYLON.ParticleSystem("particles", 5000, scene);
particleSystem.emitter = box;

If I scale the sphere the size of the particles being emitted does not change (although the Cube does).

sphere.scaling = new BABYLON.Vector3(0.1, 0.1, 0.1);

I have created an example here:

Any time the scale of the sphere is changed I had expected the size of the particles to change by the same factor (the same as the box does). However, they stay the same size.

In the playground example the cube moves left-right and then up/down as it reaches the extents defined. The scale of the sphere is changed when the cube reaches the top and also when it reaches the bottom.

Ideally, I need a system where all of the particles scale accordingly as I’m trying to use this in an AR project where the scale is continuously changing as the user moves their phone/tablet.

It’s not a bug, it’s by design, the size of a new particle does not depend on the scaling of the parent hierarchy (when a mesh emitter is used).

Maybe we could add this option, but extracting the scaling from a matrix is not free (3 sqrt + a matrix determinant calculation).

I think you are better of updating the particle minSize and maxSize yourself when you update the scaling of the sphere:

1 Like

That’s a shame… I was wanting to use the particles to create a movement trace from an object. Since it’s an AR project the scale is continuously changing so I will need to come up with a different approach.

Thanks for the swift response :+1:

1 Like