Controlling the Actor's Animation

 
 
 

After you've loaded action sources for an actor and created a crowd simulation, this animation data is initialized so that it can be used in the simulation. How the animation data is used depends on which type of simulation you've created: pedestrian (locomotion) or stadium.

Selecting the Initial Pose State for the Simulation

By default, the pose state with an ID of 0 is set as the Initial Pose State ID value in the Initialize Locomotion Data or Initialize Stadium Data compound in the simulation point cloud's Emit ICE tree .

The first pose state used is often a neutral or idle animation; however, you can select a different pose state's ID to start the simulation, such as to have all actors walking or running. This may be useful so that you don't need to create a pre-roll for your simulation if you want all the actors to be in a certain state from the beginning of the simulation.

You could also randomize the pose state ID value so that each actor instance doesn't have the identical starting pose for the simulation. This could be useful in stadium simulations where you have several types of "idle" action sources that you want the actors to randomly use.

Selecting the Initial Frame of Animation for the Simulation

By default, the initial frame of the first pose state specified (Initial Pose State ID) is randomized for each particle so that each actor instance doesn't have an identical starting point for its animation.

This is done using a Randomize Initial Frame node plugged into the Initial Frame port of the Initialize Locomotion Data or Initialize Stadium Data compound. In the Randomize Initial Frame compound, you can change the Seed and Weight value to change how the randomization occurs, or even use a different Randomize node or logic, if you like.

To have all instances of the actors start at the same frame of animation, such as for an army formation or marching parade, unplug the Randomize Initial Frame node, then set the Initial Frame value in either Initialize compound to the frame of animation that you want to use.

Note

To check the frames of animation in the action source, use the Get Actor Pose compound as described in Testing the Animation in an Action Source, or display the original animation frame number with the Get Current Frame in Cycle compound.

Setting the Actor's (Particle's) Target Speed for Locomotion

In a locomotion-type crowd simulation, the actor's velocity is determined by the speed of its COG (center of gravity) deformer in the Z direction (its horizontal speed). The actors (particles) are always trying to reach this Target Speed value over the course of the simulation.

To set the target speed:

  1. Open the Simulate Collision Avoidance compound in the simulation point cloud's Particle Simulation ICE tree.

  2. Set the Target Speed value, which is the number of Softimage units per second the particle travels.

The actor's speed is a combination of the Target Speed, the Maximum Acceleration, and Max Deceleration (both set in the Initialize Collision Avoidance compound). For example, the faster the acceleration to the target speed, the sooner the final locomotion state (see below) is reached.

The Target Speed can also determine whether or not a locomotion state is reached or not. For example, if the Target Speed is set to 10, and the "Running" state's minimum speed is 20, that state will not be reached because the actor never reaches the minimum speed.

Although the Target Speed is the actor's ultimate speed goal, the actor's speed is also affected by potential collisions with other actors or walls (see Collision Avoidance Behavior for Actors). Actors will slow down to avoid collisions, but then their speed is resumed after the threat of collision is over.

Switching between States For Locomotion Simulations

For pedestrian simulations, three basic states of locomotion are set in order of their speed in the Initialize Locomotion Data compound: Idle, Walk, and Run. Of course, you can have different types of action sources loaded than idle, walk, and run, but these three "speed states" give you a standard base to work with.

.

The trigger that determines when one state switches to the next is when the actor's current speed is greater than the Min Speed set for each state (see below).

To set each state's minimum speed and transition duration:

  1. In the simulation point cloud's Emit ICE tree, open the Initialize Locomotion Data compound's property editor.

    If you don't have the ICE Tree view open, choose the CrowdFX Simulation Edit Inspect Init. Animations command from the ICE toolbar to open this property editor.

  2. Set the Min Speed value for the Walk and Run states. This is the minimum speed (in Softimage units per second) at which the actor switches to that state.

    These are just states whose speed applies to whatever action source you have loaded for ID 1 and ID 2: they don't have to be walk and run action sources.

    Remember to set the Min Speed values in accordance with the Target Speed value for the simulation; that is, make sure that the Target Speed is at least 1 value higher than the Run state's Min Speed value if you want the actors to reach the Run state during the simulation. If you have the same value for the Target Speed as the Min Speed for the Run state, the actor's animation will flicker between the Walk and Run states.

  3. Set the Transition Duration for each state, which is the number of frames over which the transition (blending) from the previous state into this pose state happens.

  4. When you play back the simulation, the animation from each pose state is cycled over as many frames as the actor is within that state's speed range.

    For example, if an actor slows down to avoid collision with another actor or a wall, he may switch to another state that matches his speed, such as switching from running back to walking. When there is no risk of collision anymore, the actor tries to reach the target speed again and switches states again.