WARNING : This site is outdated and the PopcornFX team will no longer answer your questions here.
For all support questions please go to our Discord server
0 like 0 dislike
Hi all,

I have to do a pretty simple effect but I can't use dt fiel.

What I need to do is set an initial velocity to my particle and for example after 2 sec i want to increase gradually the emission speed till second 3 (for example start with an emission velocity of 0,1,0 and from second 2 to second 3 of the sim gradually increase till 0,3,0).

What I've tryed was in spawner script

Velocity = float3(0,1,0);

Then I created a CParticleEvoler_Script and inside I tryed in every way to multiply Velocity with dt but it always have a 0 value.

What am I doing wrong? How can I use that field??

Thank you for your answers,

by efferighi (210 points)

1 Answer

0 like 0 dislike
Best answer

dt is the delta time between the last frame and the current one, so at 60fps, dt is equal to 0.0167 (1/60).

If you want the "global" current time of simulation since the beginning you should use "scene.Time".

If you want the time since the beginning of the spawn, in the Spawner Script you have access to spawner.Age.

For example, with a Layer Infinite, in the Spawner Script you can:

float startTime = 2;
float endTime = 3;
float speed = 1 + smoothstep(startTime, endTime, spawner.Age) * 2;
Velocity = float3suf(0, speed, 0);

Here is the documentation of smoothstep: https://wiki.popcornfx.com/index.php/Scripting_reference_1120#builtin_smoothstep

by Jordan (14.6k points)
Thank you sir, it was a very complete and helpfull answer.
You solved my problem and now I understood how to use those parameters thank you again.