How to set particles gravity via gdscript?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alex Pires

How to set particles gravity via gdscript?

I’m trying to make something like this, (of course it doesn’t works):


or this


All I want is to change the gravity property of Particles using GDscript.

Thank you in advance.

:bust_in_silhouette: Reply From: omggomb

Have you tried:
get_node("Particles").process_material.gravity = Vector3(9.8, 0, 0)
? This works for me.

Lol. I was so close. It’s official: I’m getting nuts. Thank you.

But I’m realizing that’s not necessary to set up the direction, since the particles follow the character. Shame on me.

Alex Pires | 2019-03-24 19:36

Btw the class help in the top right of the script editor is really useful for that kind of things. It’s a lot faster than the online help.

omggomb | 2019-03-24 20:21

:bust_in_silhouette: Reply From: zkmark

Godot > 3.4

get_node("Particles").process_material.set("gravity", Vector3(98,0,0) )


$Particles2D.process_material.set("gravity", Vector3(98,0,0) )
1 Like