The Moving Source system allows you to have a Flow Field follow the path of a moving object, this is great for allowing your game objects to interact with their environments such as a car driving through leaves, or a character walking through some ground mist, or helicopters landing at a dusty pad.
How to use
To make use of the Moving Source system you should first have your flow field imported into your scene as a MegaFlow object. As the flow field is going to be warped and adjusted based on an object moving in a scene we should first normalize the frame of data we are planning on using so that we can more easily control the effect of the flow field based on speed. Normalizing a flow field is done in the MegaFlow inspector, select the frame you want to normalize and then click the Normalize Frame button, this will adjust all the velocities in the frame to they lay in the range of +- 1.0. With the flow source created you next position that in the scene around the object you are going to move so that it is correctly positioned.
Next create a Moving Source object from the GameObject/Create Other/MegaFlow menu, and in the inspector select the MegaFlow source and frame and also select the object in the scene that the moving source should follow by selecting it in the target param. With a source selected a button will appear called ‘Align’ clicking this will align the Moving Source object so that it matches the MegaFlow object, it will also make the Moving Source a child of the target object so that it will move around in the scene as the target object moves.
So now if click the Draw Path option and play your scene and move your game object around you will see a white line being left behind the object as it moves, this line is the deform path for the flow field, you can adjust the flow time, dt and min dist values to alter how many points are saved in the path, the spacing between them and how long the trail lasts. You should try and have as few points as possible in the path to get the look you want as the more points there are the more calculations the controllers have to do to warp the flow field, so have a play with the values.
And that is it for creating a a Moving source, but not much use having a moving source unless you have something interact with it, to do that you just need to use the new MegaFlowMovingParticle or MegaFlow MovingParticleLegacy components instead of the normal Particle controllers, they are used just the same in that you add the component to your particle system and select the moving source as the input. With that done the controller will check to see if the particle is inside the warped flow field caused by the moving source and if so will used the warped velocity value to control the particle. To find out more refer to the Moving Controller pages.
Params
Param description for the moving source component.
Source
The MegaFlow source to use
Framenum
If the selected flow source has more than one frame of data attached you can select the frame to use with this slider.
Align
If a source is selected then this button will appear, it will align the moving source object to that of the Flow source adjusting its rotation, position and scale, it will also make the moving source a child of the target object so that it will move along with that object in the scene.
Flow Time
How long the flow will remain active behind the object as it moves. Increased this to have the flow stretch further behind the the object as it moves and reduce it to limit the effect to a short distance behind.
Flow dt
The time step to save the object position, the system keeps track of the objects position and uses the resulting path to warp the flow field, the fewer points in the path the faster the warping is.
Flow Scale
A multiplier for the flow velocity, this can be used to adjust the overall effect the flow field has on your particles or objects. This works alongside any Scale value in the Flow Source.
Min Dist
The minimum distance between path sample points, use with the dt value above to adjust how many points are used in the saved path.
Target
The moving object to track the position of.
Draw Path
Draw the path of the moving objects as a gizmo in the scene.
Use Falloff
Check this to make use of the fall off curve when calculating the velocity along the warped flow path. You can use the curve to define how much effect the flow field has as it moves away from the object.
Falloff Curve
The curve describing the amount the flow velocity is changed by based on distance along the flow path. You can use the curve to amplify the flow effect as well as reduce it if you wish, or even reverse it.
Video
Video showing the Moving source system being used to disturb leaves and smoke.
Tutorial video showing how to set up a moving source.