Godot Version
4.7 Stable
Question
I’m a bit confused what went wrong with GPUParticles3D in this Player scene.
When I open the game, it emitting sphere at base( node3d attached to player) when meet condition have direction( active input) and is_on_floor()( built-in function) .
run_particles.emitting = not direction.is_zero_approx() and is_on_floor()
print(run_particles.emitting)
Player scene :
This seem to work regardless of issue, as it prints false, and true as expected.
What is strange is after scene change ( get_tree().change_scene_to_file(next_scene)) ) it sometimes spawn all draw_passes/ particles in same spot in scene with also wrong scale.
It doesn’t happen all the time, but it’s a bit annoying and not sure what exactly is issue apart from error printed out
E 0:00:49:755 get_draw_pass_mesh: Index p_pass = 2 is out of bounds (draw_passes.size() = 1).
<C++ Source> scene/3d/gpu_particles_3d.cpp:309 @ get_draw_pass_mesh()
this refers to godot/scene/3d/gpu_particles_3d.cpp at 5b4e0cb0fd279832bbdd69fed5354d4e5ad26f88 · godotengine/godot · GitHub
Quick video demo
What could be process to figure out what is going on there?
Especially I don’t understand this error from engine, as I checked the Draw Passes - passes are 1 at all the time.
There is no animation track which would be changing this value either, neither piece of code which overrides it.
so I recreated the GPUParticle3D from fresh, and this seem to solved the issue.
- maybe it’s something from upgrade, originally it’s created on 4.2.1 the project.
old ( I changed there Sphere for Box - but this didn’t resolved it so it wasn’t a mesh)
[node name="RunParticles" type="GPUParticles3D" parent="BasePivot" unique_id=1795342937]
visible = false
cast_shadow = 0
emitting = false
amount = 32
lifetime = 0.5
process_material = SubResource("ParticleProcessMaterial_c2uhr")
draw_pass_1 = SubResource("BoxMesh_o4itx")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_c2uhr"]
emission_shape_scale = Vector3(1, 0.25, 1)
emission_shape = 1
emission_sphere_radius = 0.4
gravity = Vector3(0, 1, 0)
damping_max = 1.0
scale_min = 0.2
scale_max = 0.4
scale_curve = SubResource("CurveTexture_vbp78")
new
[node name="GPUParticles3D" type="GPUParticles3D" parent="BasePivot" unique_id=278418748]
emitting = false
amount = 32
lifetime = 0.5
process_material = SubResource("ParticleProcessMaterial_2mi1u")
draw_pass_1 = SubResource("SphereMesh_uo7yp")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2mi1u"]
emission_shape_scale = Vector3(1, 0.25, 1)
emission_shape = 1
emission_sphere_radius = 0.4
gravity = Vector3(0, 1, 0)
damping_max = 1.0
scale_min = 0.19999999
scale_max = 0.39999998
scale_curve = SubResource("CurveTexture_j3pel")
So for anyone experience similar issue, try make new node with fresh particleprocessmaterial.
Note : deleting cast_shadow = 0 didn’t solved it, I tried it.