0 like 0 dislike

Hi ,

Can some one explain or point out a tutorial for beginner how to publish the Physic ConstantAcceleration on x,y,z in the attribute panel ? I use the V1.12.5 .

Thank you

Picture reference : https://ibb.co/dPMkyYM


by mtakerkart (160 points)

1 Answer

0 like 0 dislike


In version 1.x, this is not as straightforward as in PopcornFX version 2.0, but can still be done.

The "ConstantAcceleration" property of the physics evolver is totally static, meaning you have no way to bind it directly to a dynamic value or attribute. Hence the name of "ConstantAcceleration" :)

However, if you scroll at the very bottom of the physics evolver, there is the "AccelField" property, where you can specify the name of the particle field to be used as the particle acceleration. It gets added to the "ConstantAcceleration" value.

So, what you can do:

1- select the "Fields" node of your layer in the treeview

2- add a new "float3" field named "Accel". The physics node as "Accel" as the default value of its "AccelField" property. If you decide to name the new field "MyAccel", you'll have to also set the "AccelField" property of the physics node to "MyAccel"

3- set the "ConstantAccel" field of the physics node to 0 so it only takes your new dynamic accel into account.

4- add a new "Acceleration" attribute (the name needs to be different from the particle field, you can't have both named "Accel"

5- either in an evolve script, or in the spawn script, write "Accel = Acceleration;". This will load the "Acceleration" attribute and store it into the "Accel" particle field.

Your physics node should now pick-up the acceleration setup in the attributes.

Assigning the attribute to the particle field in the evolve script will read it each frame. However, if you set this attribute in-engine only when you start the effect, and not dynamically as the effect updates, you can do that in the particle spawn script, and it'll be slightly faster to simulate, especially if it's the only thing your evolve script does.

by Julien (32.8k points)