Dan
March 10, 2020, 11:47pm
1
Hi, Using Particle Helper I am trying to position the built-in smoke particle at a position in space.
// Smoke
BABYLON.ParticleHelper.CreateAsync(“smoke”, scene).then((set) => {
set.emitter = BABYLON.Vector3(1, 15, -10); // the starting location doesn’t work
emitter.position = BABYLON.Vector3(1, 15, -10); // doesn’t work either
set.start();
});
There should be a simple way to position the built-in particle system in space, no ? or am I missing something ?
Thanks.
Use the worldOffset
property of the particle system object to position the system in the world.
Note that you get a ParticleSystemSet
when calling CreateAsync
, so you should do something like:
set.systems[0].worldOffset = new BABYLON.Vector3(0, 0, 0);
Dan
March 11, 2020, 9:35am
3
Thanks a lot you are a savior !!
It worked.
Hi, new to BabylonJS and TypeScript I got the same error…no solutions untill i found the famous “TypeScript problems with polymorphism”.
So here is my solution if the above one does not work AND if you are using TypeScript :
ParticleHelper.CreateAsync("smoke", scene).then((set) => {
const pm: IParticleSystem = set.systems[0];
pm.emitter = bigSphere; //or pm.worldOffset = .... or anything else
set.start();
});
By the way a word to BabylonJS team from France : “Well done guys ! Really impressive”
2 Likes
Always a pleasure to read this coming back from vacations