Repulsion computes the distance in 2 dimensions to a given object and applies a "repel" effect according to the distance and strength paramters. Next, the item is projected onto the surface in its new position using the  fpSurfaceHitZ function. To use it:

  1. Use Object to pick an object from the scene that will repel forest items.
  2. Use the Distance parameter to set falloff limits of the repulsion effect.
  3. Use the Strength parameter to push scattered items away from the repulsion object.
  4. Use the Controller property to pick a track from the scene that is added to the distance parameter to control the falloff limits. For example if you are using a ball to repel Forest items you could use the Radius controller to automatically adjust the falloff distance as the ball is re-sized.


Effect Script:

vector vec = [fpItem.position.x - Object.position.x, fpItem.position.y- Object.position.y, 0];
vector dir = unit(vec);
real dist = length(vec);
real dd = easeOut(dist, 0, (Distance+Controller)*5, (Distance+Controller)*2.5, 0) * Strength / 100;
vector displ = dir * dd;
fpItem.position = fpItem.position + displ;
fpItem.geomID = if(dd > 0,1, fpItem.geomID);
fpItem.position.z =  fpSurfaceHitZ(fpItem.position);

You can find this Effect within the Forest Effects Library.

This Effect Uses:


  • Object
    Type: Object
  • Distance
    Type: Scene Units
  • Strength
    Type: Percentage
  • Controller
    Type: Controller


  • fpItem.position
    Position of Forest Item in local coordinates
  • fpItem.geomID
    Index in the Geometry List, starting at zero


  • easeOut(x,x1,x2,y1,y2)
    Returns an ease-out interpolation between y1 and y2. Returns y2 when x > x2.
  • unit(v)
    Returns a unit vector in the same direction as v.
  • length(v)
    The length of v.
  • fpSurfaceHitZ(p)
    Computes the projection of p onto the Forest surface (XY mode only). Returns z value.