PySwarm Wiki

Back to PIA's main page

Attraction V2.jpg


When ATTRACTION is activated, BOIDs will attempt to move towards a specified object in the Carrara scene. Like “moths to a flame,” use an attractor to draw BOIDs towards a specific location in your scene. Also, when attractor objects move around in the scene, the BOIDs will attempt to follow. So you can use an attractor to draw BOIDs along a specified path or route.

Attraction Object Name[]

The name of the attractor object in the Carrara scene.

Attraction Strength[]

This value represents the strength of the attraction the attractor object has on the BOIDs. Higher values mean a stronger pull.

Attraction Radius[]

You can also set a distance (radius) from the attraction object for which BOIDs will be affected by the attractor. BOIDs that fly within this distance will be attracted; those outside will not.

Tips and Limitations[]

  1. Negative Attraction Strength has the opposite effect - BOIDs will move away from the attraction object.
  2. With V0.5, positive and negative attraction (set by Attraction Strength) works different. For positive attraction, the force of attraction increases as BOIDs get farther away from the attractor, and decreases as they get closer. For negative attraction, it works in the opposite way. The repulsion force gets stronger as BOIDs move closer to the attractor.
  3. Attractors can move in the Carrara scene, and BOIDs will follow. This is useful to guide BOIDs along a specific path or in a specific direction.


Below are some examples for using the Attraction Rule.

Guiding BOIDs with Attractors[]

Add a target helper object and use a Motion Path to create a path. Use it as the attraction object in the scene to guide BOIDs along the same path (only using more natural motion).​

Using Negative Attractors[]

If you want BOIDs to be repelled by an object in your scene (even one that is moving), set the Attraction Strength value to a negative number (e.g., -1.0).
If you use a negative strength with an attraction radius, you can create a keep-away zone about the attractor. This works great if you are animating bugs in a room with a single bulb light source, where the bugs attempt to stay in the dark. Use the light source as the attractor object, use a negative strength, and set the radius to be at the edge of the light.