How do I make particles start outside and move inwards?

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

Right now I got the particles to move inwards,
but it is starting at the center and moving outwards first.

I only want it to move inwards, but to do that I need to make it start away from the center.

Is there a way I can do this?

The node type is CPUParticles2D.

:bust_in_silhouette: Reply From: Calinou

This can likely be done by using a positive Linear Velocity and a negative Linear Acceleration in the CPUParticles2D node. Over the particle’s lifetime, the negative acceleration will make the particle slow down then reverse. If the lifetime is long enough, the particle will be going inward at the end of its lifetime.

The same can also be achieved with GPU-based particles and 3D particle nodes.

I don’t see Linear Velocity. I filtered properties that have “velocity” in them and I only see Initial/Angular/Orbit velocity. Did you mean Initial Velocity? I tried making the initial velocity positive and linear acceleration negative but it didn’t work.

Primero | 2022-04-08 03:07

Negative acceleration also doesn’t work on Godot 4.0.2, nor with Accel Curve, although crazy values like -10000 for the simple Accel cause some particles to go the other way (but not in a manageable way).

My case is different from OP where I need a smoke to move left and right following an S pattern. A Velocity curve would help, but right now there is only a simple value (which can only be positive).

Hyper Sonic | 2023-05-22 12:29

:bust_in_silhouette: Reply From: Inces

You can choose emission shape in particle material. Choosing anything other than point will make particles randomly spawn within this shape. Now You can convert particle material to shader material, find the piece of code connected to emission_shape uniform ( it is near the top ) and rewrite mathematical formula, so particles will only be spawned on the edges of shape. Be aware, that shader code for emission shape will not exist in shader if You don’t choose emission shape before converting particle material into shader material.

I have set emission shape to sphere, and made a new Shader Material for the particle, but I don’t see the code which I need to edit. When I make the shader material, the ‘Shader’ property (which seems to be the script file) is empty. Do I need to make a Shader script file?

Primero | 2022-04-08 03:04

No no, You are supposed to create new particle material like normally, next choose emission shape to sphere, and then go back to material options and choose “convert to shader material”. This option appears after creating particle material. It will give You access to shader code behind particle material.

Inces | 2022-04-10 14:11

I changed emission shape back to point,
and then under ‘Materials’ tab, I created a ‘NewCanvasItemMaterial’.
Then changed emission shape to sphere, and converted the material to ‘ShaderMaterial’.

Did I do it correctly?
I see there is a script attached this time, but when I open it there are only two lines of code, which are

shader_type canvas_item;
render_mode blend_mix;

I don’t see ‘emission shape uniform’. Did I go wrong somewhere?

Primero | 2022-04-11 01:25

there are 3 types of materials : canvas, spatial and particle. All of them are shader materials with code hidden from the user. Yet every material can be converted into shader material with script. Here we just want to convert particle material into shader material
When You use Particles node, You have to choose particle material. Only this material has all these options like emission shape and starting velocity, gravity. So only change emission shape to sphere, and convert it whole into shader material. No canvas material inbetween. You will see a large shader script attached

Inces | 2022-04-11 09:13

So you mean I should make a ‘New ParticleMaterial’ in the Material tab of the particle node? I don’t have that option… I only get ‘New CanvasItemMaterial’ and ‘New ShaderMaterial’. Am I looking in the wrong place?
Screenshot: Imgur: The magic of the Internet

Primero | 2022-04-13 05:53

Particles2D and Particles3D node don’t have material property, they have Process Material. There You have only 2 options to choose from - particle material and shader material. And at this point I realised You are working with CPUParticles haha :stuck_out_tongue:
But what is the point ? can’t You use normal particles ? :wink:

Inces | 2022-04-14 14:56

It’s not the case for me… Imgur: The magic of the Internet

Primero | 2022-04-15 03:20

I see it has process materials as well though
I’ll try it right now

Primero | 2022-04-15 03:21

I made sure that I created a NewParticlesMaterial, set emission shape to sphere and converted it into ShaderMaterial. But I can’t find code related to emission_shape… Imgur: The magic of the Internet

Primero | 2022-04-15 03:30

images don’t load :frowning:
Did You menage to get access to huge shader script ? Ctrl + F to find which part of code is connected to uniform emission_shape_radius, You will easily find mathematical formula with sinuses and cosinuses near the upper part of the code

Inces | 2022-04-15 10:14