2009

line, and also substituting the names of your Avoid behaviors in the list in
transfunc4, adding or deleting lines as necessary.
The example script illustrates a second important point: Cognitive controller
transition scripts can contain multiple functions. Crowd first executes the
function specified 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 functions. In this case, transfunc4 calls the first function,
isDelegateAvoiding, passing it three parameters.
Lastly, the script contains a special function, getBehaviorType, that compares
an input behavior against a list of known behaviors, and on a match, returns
the known behavior. In this case, transfunc4 runs 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. Use of this function is more efficient and flexible than
testing for specific behaviors, especially if your scene 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 transfunc4.
NOTE See the online User Reference for this sample code.
4864 | Chapter 17 character studio