Godot Version
4.2.stable
Question
I’m instantiating a bunch of GPUParticles3D, all loaded from the same packed scene, and their randomness is staying in sync. Is there a way to avoid this, and have them each fire independently?
4.2.stable
I’m instantiating a bunch of GPUParticles3D, all loaded from the same packed scene, and their randomness is staying in sync. Is there a way to avoid this, and have them each fire independently?
My guess is that all instances are using the same Process Material resource. Set the resource as unique to solve this.
You can do this by setting the process material local to the scene it’s instantiated in. You can get this done by attaching a script to the GPUParticles3d and setting it in the ready function so all instances are automatically set to local.
Or you do this individually by accessing the process material variable on the instance from wherever you create the instance.
extends GPUParticles3D
func _ready():
process_material.set_local_to_scene(true)
That’s extremely helpful - that function is the one I was looking for when I was trying to solve the problem initially - but unfortunately it still doesn’t desync them.
It DOES make it possible for me to manually semi-desync them:
func _process():
if should_be_emitting and randi() % n > p:
emitting = not emitting
which didn’t work before, but it still leaves whichever ones are on at any given time all firing at the same time. At higher fire rates it still achieves basically the effect I was looking for, but it leaves me without the option to set the fire rate any lower.
Is there an equivalent function for the GPUParticles3D node, maybe? Or something else I’m missing?
My current code instantiating the emitter:
var particler = load("res://particles.tscn").instantiate()
add_child(particler)
particler.process_material.set_local_to_scene(true) # allow manual desync
particler.owner = self # So I can find it with find_child
The Explosiveness is set to 0 and the Randomness is set to 1, not sure what other parameters might be relevant?
P.S. Thank you so much!