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

asked May 20 in Engine by artsyWraith7 (24 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.

answered May 20 by kidscancode (17,132 points)
selected May 20 by artsyWraith7

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.