Is there a way to move particles with the wind?
Currently I have a wind system that I use to move grass, trees, crops, etc. It is a cginc that I can import in any vertex shader and it will bend the vertex to the wind.
But it seems that particles can only be affected by wind zones? I could create a global wind zone and have it set to whatever is the wind at the player position, but that less than optimal. I’d like to query the precise wind information at the particle position, and accelerate it based on that.
You can move particles using burst without using the Get/SetParticles API? I was not aware of that. The wind calc is currently GPU only, but it would be trivial to make a Burst version of it.
Edit: After a bit of googling I believe I figured out how, but I still have one question: Can I also spawn particles through a burst job?
You can’t spawn particles in the c# job, only update them.
If you do something like:
ps.Emit(100, emitParams);
where the params sets a property to a magic number, you could detect those in the c# job to know they just spawned. (just be careful it’s not a property that the native update might change, eg probably dont use the position as something in the native update is probably moving your particles too)
Sorry i really ought to have given you some links:
What a shame, because my grass cutting code happens in c# burst, and it does have the precise position and type of each blade of grass it cuts right then and there (and then gets compressed into total_grass_cut per grass_type to report to whomever cut the grass so he can get loot and exp).
Some internal stuff happens to make the IJobParticleSystem able to access the particles list, right? Because I think I could have all particles pre spawned and marked as ‘dead’ or ‘inactive’, and then the grass cutting code iterates over them to find the first dead/inactive to ‘spawn’ it.
This will end up becoming a feature request, but if the particle system were to let us access by c# burst the ‘first dead/inactive’ particle to ‘spawn’ it, it would be pretty amazing.