CParticleEvolver Localspace

From PopcornFX
Jump to: navigation, search

Localspace evolver Last update: v1.10.0 - Main page : Particle evolvers Particle evolvers

By default, once they are emitted, popcorn particles live their life in worldspace, and have no knowledge of their original instance's location and transforms. Therefore, if the source instance moves around, the already spawned particles cannot be affected, and do not move around with it.

The localspace evolver is useful to make some or all of the other evolvers run in the effect's instance localspace, rather than in worldspace.
It is most useful with the Projection evolver Projection evolver, Physics evolver Physics evolver, and Attractor evolver Attractor evolver.

You can have a look at the Particle Tips: Local shape colliders or Particle Tips: Dealing with attractors pages for additional infos/tips and a concrete usage example of that evolver.

! WARNING ! In version 1.5.4 up to 1.7.3, localspace particles do not cohabitate well with continuous spawners, you should DISABLE continuous spawning for localspace particles to work correctly.
Fixed since 1.8.0

Localspace evolver Node properties

Field name Default value Description
Localspace evolver General
ModeEnter WorldToLocal_Previous Transform mode applied to the transformable streams BEFORE running the sub-evolvers.
  • WorldToLocal_Previous : world => local transforms for the previous frame
  • WorldToLocal_Current : world => local transforms for the current frame
ModeLeave LocalToWorld_Current Transform mode applied to the transformable streams AFTER running the sub-evolvers.
  • LocalToWorld_Previous : local => world transforms for the previous frame
  • LocalToWorld_Current : local => world transforms for the current frame
TransformTranslate true If deactivated, the evolver will ignore the instance's translations.
TransformRotate true If deactivated, the evolver will ignore the instance's rotations.
Localspace evolver layout

Localspace evolver Auto-fields

The localspace evolver does not automatically create any particle fields.

Localspace evolver Side-effects

The localspace evolver will modify ANY field that has its transforms flags set to anything else than 'None':

  • Transform: None TransformNone : Will not be touched by the localspace evolver.
  • Transform: Translate TransformTranslate : Will be translated.
  • Transform: Rotate TransformRotate : Will be rotated.
  • Transform: Full TransformFull : Will be fully transformed.

For example, in the following declaration, the following fields will be transformed:

CParticleEvolver Localspace TRFields.png

Localspace evolver What it does

Standard mode

If used as a standard evolver, without sub-evolvers, the localspace evolver will apply, for each particle, the 'ModeEnter' transform, followed by the 'ModeLeave' transforms to all transformable particle fields.
With the default values of 'WorldToLocal_Previous' and 'LocalToWorld_Current', This will apply the movements of each instance to all their particles.
This means that if the FX instance is moved 5 units in the world, all its particles will be moved by the same 5 units, effectively making them appear as if they were moving with their parent instance.

Localspace evolver with sub-evolvers

NOTE : It is useless to use a localspace evolver that has no sub-evolvers with any other mode than Previous => Current, as Previous => Previous or Current => Current would essentially produce an identity transform.

Standalone localspace evolver

Sub-evolvers mode

The Sub-evolvers mode is the one use to have local physics, collisions, project on local shapes, and use attractors relative to the instance location.
(can be achieved by drag-n-dropping any evolver ON the localspace evolver)

Localspace evolver with sub-evolvers

Then, the following will be done at runtime:

  • Transform all the transformable particle fields by the 'ModeEnter' transform, moving them from worldspace to localspace.
  • Run each child evolver (they will access particle fields that are now in localspace).
  • Transform all the transformable particle fields by the 'ModeLeave' transform, moving them from localspace to worldspace.

Localspace evolver with physics sub-evolver