Method

This node simulates a flocking behavior on a particle system. This is typically used to make particles behave like a flock of birds or a shoal of fish.

The simulation solves several different behaviour goals: making particles move towards their goal position (goal seeking); making particles avoid others nearby (avoidance); making particles stay close to their neighbours (cohesion); and making particles move in the same direction as their neighbours (alignment). The results of these conflicting goals are weighted together to produce a new velocity for the particle. The weights for the different behaviour goals are summed together and normalised, so a large weighting on one behaviour reduces the effect of the others.

The goal positions are determined by connecting nodes to the Flock Goal Nodes input. Where 3D objects are used, vertex positions are used as goals. Otherwise the transform position of the node is used. Where there are multiple goals particles are each assigned a goal either randomly or based on their emitter.

The range in which particles can see their neighbours is determined by radii – Cohesion Radius and Avoidance Radius. The neighbourhood search is achieved internally by placing particles into a grid, and the location, cell size and resolution of this grid may be controlled in order to optimise the performance requirements of the node. Larger search areas, and search areas containing more particles, increase demands on performance. Larger grid resolutions may be desirable when dealing with large areas of space.

The sample project “flocking_birds.dfx” included in the Notch installer provides an example of the flocking affector in action.

Example
This image is taken from the “flocking_birds.dfx” sample project.
Example Nodegraph

Transform

Name Description
Position X Move its position along the x-axis in local space.
Position Y Move its position along the y-axis in local space.
Position Z Move its position along the z-axis in local space.
Rotation Heading Rotate the object about the x-axis.
Rotation Pitch Rotate the object about the y-axis.
Rotation Bank Rotate the object about the z-axis.
Scale X Scale along the x-axis.
Scale Y Scale along the y-axis.
Scale Z Scale along the z-axis.

Inherit Transform Channels

Toggle which transform channels should be inherited. By default, all are on.

Attributes

Name Description
Cell Size The area around each particle that resists other particles from getting within a certain distance.
Weight How strong an effect has on the particles.
Goal Seeking How much particles will want to move towards the goal input.
Min Goal Seek Threshold The minimum weighting that will be applied to the goal seeking behaviour.
Max Goal Seek Threshold The maximum weighting that will be applied to the goal seeking behaviour.
Avoidance How much particles attempt to avoid each other.
Cohesion How much the particles try to stay close to each other.
Alignment How much the particles try to move in the same direction.
Cohesion Radius Distance at which the particles can see others when determining cohesion.
Avoidance Radius Distance at which the particles can see others when determining avoidance.
Visibility Angle The field of view angle at which particles can see others.
Rotation Limit The maximum rate at which particles can change direction.
Max Speed Maximum speed the particles can move at.
Min Speed Minimum speed the particles can move at.
Slowdown At Goal Distance Distance from the goal that particles begin to slow down.
Goal Movement Weight How much the goal movement affects the flock movement.
Kinect Motion Threshold Threshold for which movement from the Kinect will be followed.
Mesh Goal Seeking The weighting for the mesh goals.
Null Goal Seeking The weighting for the transform goals.
Life Effect Coeffs How much the particles are affected by the affector at different stages of the particles life cycle. Values 1 and 2 are control points used to control a bezier curve between values 0 and 3.
Grid Resolution The resolution of the underlying neighbour search grid.
Limit to 2D Limits the affectors functionality to only its x and y plane.
Particle Goal Allocation Mode Choose how a particle decides which goal to move towards.
  • Random, the particles are randomly assigned which goal to move towards.
  • Per Emitter, the particles are assigned goals by emitter – so every particle from one emitter has the same goal.

Inputs

Name Description Typical Node Input
Flock Goal Nodes Nodes input will be used as the goals for the flock effect. Null
Grid Transform Used to control the size of the underlying grid used for neighbourhood searches. Bounding Box
Obstacle Nodes These nodes will be avoided by the flock effect 3D Object
Kinect Skeleton A skeleton generated from a kinect. Kinect2 Skeleton
Affected Emitters Choose which emitters can be affected by the affector. Primitive Emitter
Procedural Falloff Use the SDF values from a procedural system to dictate the falloff. Procedural Root
Transform Modifier Links all transform properties to the input node. Null
Target Node Always faces the x-axis towards the inputs anchor point. Null
Local Transform Override Override the transformation values of the node, relative to its parent. Null

Outputs

All nodes connected to this node are treated as if flowing to the parent node, and inherits any transformation changes along the chain.