Use ParticleHelper to simulate a rain scenario, but some places don’t want it to keep falling, is there any way to achieve this?
[PG there] (https://playground.babylonjs.com/#XQ8H3C#73)
How to achieve the function of this green plane like an umbrella?
In other words, I need this green plane to block the raindrops on top.
Maybe something like this
sorry ,my English is really poor
Hello 
You can edit the update function, and add a ray pick upward. If it hits, it mean the particle just went though your umbrella, and then you recycle it.
// Which mesh should act as umbrella
function predicate(mesh) {
return mesh == plane;
}
// Edit update function
const old = rainFall.updateFunction;
rainFall.updateFunction = function(particles) {
old(particles);
for (var index = 0; index < particles.length; index++) {
var particle = particles[index];
var ray = new BABYLON.Ray(particle.position, new BABYLON.Vector3(0,1,0), 10.0);
var pickInfo = scene.pickWithRay(ray, predicate);
if (pickInfo.hit) {
rainFall.recycleParticle(particle);
continue;
}
}
};
PG applying this to the fall system, but you would do the same for splash, I guess :
5 Likes
Your answers were so perfect and quick, that’s why I love babylonjs! Thank you again
3 Likes