0 votes

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.

in Engine by (91 points)

2 Answers

+2 votes
Best answer

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

by (1,511 points)
selected by

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.

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.

+1 vote

Godot > 3.4

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


$Particles2D.process_material.set("gravity", Vector3(98,0,0) )
by (24 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.