0 votes

I'd like to set the size of the particle effects based on the collision shape of the body that they surround at the time of instantiation.
I can't seem to access anything about the node's emission shape from script.

For example (albeit a crude one):

var p = particles.instance()
var size = entity.get_shape().extents
p.extents = size

in Engine by (26 points)

1 Answer

+2 votes
Best answer

The emission shape is a property of the ParticlesMaterial. If you hover your mouse on the material, you'll see the property name is process_material. Hovering on the emission shape shows emission_shape. Since you said "extents", I assume you're using a "Box" shape, in which case the extents property is emission_box_extents.

So, to set it:

$Particles2D.process_material.emission_box_extents = Vector3(2, 2, 2)

All this and more in the ParticlesMaterial reference.

by (20,475 points)
selected by

Works great thanks :P

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 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 webmaster@godotengine.org with your username.