PySwarm Wiki

For those new to PySwarm or to the PySwarm Interface Application (PIA), this wiki page will step you through the basics of creating your first PySwarm animation. 

Set Up the Carrara Scene[]

Before you can use PySwarm, you need to set up your Carrara (.CAR) animation scene first. This section will discuss :

  • Creating and reusing default Carrara files when starting a new PySwarm project
  • Setting BOID orientation and hot points
  • Naming, replicating, and number your BOIDs
  • Adding other objects to your Carrara scene - cameras, focii, and attractors




If you already have this basic understanding, you can find a more detailed discussion on this topic by clicking here <Under Development>.

This section provides a basic overview about PySwarm scene set-up by using an existing default scene. These default scenes will be part of the V0.6 PySwarm package. If you don't have these .CAR files, you can download them with the following link: 

In the release package, you should find a Carrara scene file named PySwarm V0.5 Test Scene 1. Start Carrara and open this scene. Let's start by looking at the objects currently in the scene that relate to PySwarm animation.


Default Carrara Files[]

The BOIDs[]

First, note there are 20 objects all named "BOID" followed by numbers in sequence. These are the objects PySwarm will animate in the scene. It is necessary to name and number BOIDs this way so PySwarm can find the objects in your scene to manipulate. The base name ("BOID" in this case) can be any name, as long as each BOID begins with this, followed by a sequential number starting with 1.

PySwarm Camera and Camera Focus[]

PySwarm will also manipulate (move) ONE camera in your scene, based on a constant (x,y,z) offset from the BOIDs' center of mass, which is the average position of all the BOIDs in the scene. As the BOIDs move about, so does their center of mass, "dragging" the camera along with it. In this example scene, the camera we're going to animate is called "Conical."

You can also use an object in your scene to keep the camera (actually any camera) pointing towards the BOIDs as they move about (using the "Point At" modifier for the cameras, and selecting the focus object). We'll need to tell PySwarm what object to use. For this animation, it is called "CameraFocus." You'll notice this object is an invisible sphere so it won't show up in the final rendering.

Animation Sequencer[]

Now examine the animation sequencer. You'll notice PySwarm has already inserted a number of keyframes into the scene for the BOIDs, the camera, and the camera focus. PySwarm creates BOID animation by inserting keyframes into the scene.In the animation scrubber, you'll notice these objects have 10 keyframes for each second in the 60 second animation.

Select the Conical camera for display and play the animation by clicking the Play button.

For the purpose of this tutorial, we're going to replace the current animation sequence with a completely new one. So, let's see how that is done.

Use PIA to Set PySwarm Parameters[]

This tutorial assumes you have downloaded and installed all the PySwarm files. If you have not installed all of the necessary components, or if you need to review what is necessary to install the latest components, you should go HERE before continuing.

Launch the PySwarm Interface App (PIA)[]

Create a New Project[]

Set a Few Parameters[]

Save the Parameters[]

Generate the PySwarm Script[]

PySwarm is a Python language script that uses the PyCarrara plug-in for Carrara to insert keyframes into your animation sequence. But if you're thinking you have no clue what this means or that you've never programmed, no need to worry! PySwarm has been designed so that all of this happens behind the curtain. All you need to know is that PIA will create a script file that you will need to import into your Carrara scene.

Click the Generate Script... button

The following window should appear.


You are ready to import the script into your scene and create the animation.

Import the Script into Your Scene[]

Importing the PySwarm script into Carrara is what causes the keyframes to be inserted for the BOIDs in your scene, and optionally for the camera and camera focus.

Select File/Import



"xxx" tells you the PySwarm import was successful.

Review the Results[]

Review the results by clicking the animation Play button.

<What you should see>