startPositionFunction not with GPUParticleSystem

Hi everyone,

I use the startPositionFunction to set randomly the startPostion of the particles along the surface of a bunch of meshes and wanted to use it with the GPUParticleSystem. But it seems that this function (and the direction function) only works with the ParticleSystem.

Are there any suggestions how to set the startPosition for particles at specific coordinates with the GPUParticleSystem?

You have to use the emitter for that. GPUparticles do not let you be more precise as all the code is running inside the GPU

Yep yep, that’s clear to me. Here are some parts of the code:

particleSystem.particleEmitterType = new BABYLON.BoxParticleEmitter();
particleSystem.startPositionFunction = (worldMatrix, positionToUpdate) => {
	let vert = vertices[verticesKeys[random(0, verticesKeys.length - 1)]];
	return BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(vert.p.x, vert.p.y, vert.p.z, worldMatrix, positionToUpdate);
}

this code works perfectly well with ParticleSystem but not with GPUParticleSystem.

Yep. As I said this is not supported

Ah okay, that was not clear to me in your first response.
Thank you!

Oh sorry :slight_smile: Yeah I meant that you can only change the emitter position but not each individual particles when using GPU particles