9

1210 Chapter 14: character studio
displays a message whenever delegate 4 is found to
be avoiding delegate 2.
Youcanusethisscriptasisinyourownsimulations
to check for whether one delegate is avoiding a
second by substituting the delegates names in the
above line, and also substituting the names of your
Avoid behaviors in the list in transfunc4,addingor
deleting lines as necessary.
The example script illustrates a second import ant
point: Cognitive controller transition scripts can
contain multiple functions. Crowd first executes
the fun ction spec ifie d in the State Transition
dialog > Transition Condition field, and that
function calls one or more additional functions in
the script, which, of course, can also call func t ions.
In this case, transfunc4 calls the first func tion,
isDelegateAvoiding, passing it three par ameters.
Lastly, the script contains a special f u nction,
getBehaviorType,thatcomparesaninputbehavior
against a list of known behaviors, and on a
match, returns the known behavior. In this case,
transfunc4 r uns through the list of behaviors
currently influencing Delegate04, testing each with
getBehaviorType, and if an Avoid behavior is in
effect, proceeds to check whether Delegate02 is
an obstacle of that Avoid behavior. U se of this
function is more efficient and flexible than testing
forspecificbehaviors,especiallyifyourscene
contains many behaviors of the same type, or
you ’re constantly editing behavior settings. You
can see the returned behaviors by removing the
comment (double hyphen) from the beginning of
the following line in tr ansfunc4.
Note: See the online User Reference for this sample
code.
Interfa ce
Prior it y—Sets the transitions precedence.
When more than one trans ition tests t rue, the
software uses the Priority setting to determine
which transition occurs. It performs the transition
w ith the lowest Priority setting . Thus, for example,
a transition with a Priority setting of 0 takes
precedence over one w ith Priorit y 1, and so on.
Duration—The number of frames the software
takes to effect the transition b etween states.
Ease I n—Therateatwhichthetransitionbegins.
Default=0.5. Range=0 to 1.0.
Lower values cause a more abrupt transition, while
higher va lues cause a more gradual transition.
Ease Out—Therateatwhichthetransitionends.
Default=0.5. Range=0 to 1.0.
Lower values cause a more abrupt transition, while
higher va lues cause a more gradual transition.
Note: ThesumofthevaluesforEaseInandEase
Outmustbelessthanorequalto1.0.Thesoftware
won’t let you set a va lue for either parameter that
would cause the sum to exceed 1.0. To increase
the value of one parameter when its value equals