Biped and Crowd Interaction

 

   

Character Studio - Quick Navigation

It is possible to influence clip selection for bipeds during a Crowd solution by using preferred clips. The following biped MAXScript functions allow users to set the biped preferred clip during a crowd solution.

   

biped.numPrefClips <biped_ctrl> 	 

Returns the number of preferred clips

   

biped.getPrefClip <biped_ctrl> <index_integer>   

Returns the name of the nth preferred clip. The index is 0-based.

   

biped.clearPrefClips <biped_ctrl> 

Clears the preferred clip list.

   

biped.addPrefClip <biped_ctrl> <name_string> <prob_integer> 

Adds the clip to the preferred clip list with the given probability. Returns true if added, false if not added because it was already in the list. If the clip is already in the preferred clip list, its probability is changed to the specified probability. The range of meaningful probabilities is -100 to 100 where negative values make the clip less likely to be taken. A value of -100 effectively ensures that the clip will not be taken, and for values greater than -100, a comparision is done where choices of transitions prefer higher values (with positive values being favored over negative ones and zero being neutral). Negative preferences are useful when you want to avoid certain clips. For example , if have 30 clips, you can easily avoid a clip by setting it with one negative value without having to set positive preferences for the other 29 clips.

   

biped.getPrefClipProb <biped_ctrl> <index_integer> 

Returns the probability of the nth preferred clip. The index is 0-based.

   

biped.deletePrefClip <biped_ctrl> <name_string> 

Deletes the named clip from the preferred clip list. Returns true is successful, false if the clip was not in the list.

   

biped.isPrefClip <biped_ctrl> <name_string>  

Returns true if the clip is in the list, false if not.

   

biped.getCurrentClip <biped_ctrl> 

Returns the name of the currently active clip for this biped - only relevant during a crowd solve.

   

biped.getClipAtTime <biped_ctrl> <time> 

Returns the name of the active clip for the biped at the specified time. If a transition between clips is occurring at the specified time, the clip being transitioned from is returned.

NOTE:

Preferred clip names are case-sensitive.

The following are examples showing how the crowd system "PerFrameFn" can be used to dynamically change the biped preferred clip.

EXAMPLE

-- changes the preferred clip as a function of frame number.
fn PerFrameFn crwd t = (
a = $bip100.controller
if (t == 200f) then
biped.addprefclip a"jog_L45"100
else
biped.deletePrefClipa"jog_L45"
)

EXAMPLE

-- changes the preferred clip as a function of the current clip.
fn PerFrameFn crwd t = (
a = $bip100.controller
if (biped.getcurrentclip a =="jog_L135") then
biped.addprefclip a"jog_L45"100
else
biped.clearPrefClipsa
)

See Also