ADVANCED INTERACTIONS

On this page we'll go into some details on advanced interactions that can be achieved using the model behaviours. This page assumes you have read and understood the basic Using Model Behaviors and Creating Cockpit Interactions docs, and as such will concentrate on giving the templates and parameters you should be using - with examples where appropriate - rather than explaining the details in depth.

 

 

Mouserect - Events

All mouserect events can be configured externally, and every interaction can use some code setup to be able to add code in to each of them. The full list of parameters for each mouserect event flag are defined as follows:

 

EV_PARAM Description
ON_PRIMARY_PRESSED Code executed when the primary button is pressed
ON_SECONDARY_PRESSED Code executed when the secondary button is pressed
ON_TERTIARY_PRESSED Code executed when the tertiary button is pressed
ON_PRIMARY_DOWN Code executed when the primary button is down
ON_SECONDARY_DOWN Code executed when the secondary button is down
ON_TERTIARY_DOWN Code executed when the tertiary button is down
ON_PRIMARY_RELEASED Code executed when the primary button is released
ON_SECONDARY_RELEASED Code executed when the secondary button is released
ON_TERTIARY_RELEASED Code executed when the tertiary button is released
ON_INCREASE Code executed when the increase button is pressed (or held)
ON_DECREASE Code executed when the decrease button is pressed (or held)
ON_HOVER Code executed when the cursor is hovering the mouserect
ON_LEAVE Code executed when the cursor is leaving the mouserect
ON_ENTER_LOCK Code executed when the cursor is entering in the interaction mode
ON_EXIT_LOCK Code executed when the cursor is leaving the interaction mode

 

To add a custom code snippet using any of these events we use the parameter function ASOBO_Append_To_Mouserect_Events_Helper which takes a parameter using the tag EV_PARAM from the list above. You should first define the code for the parameter using the parameter name as a tag, and then the contents of the parameter will be appended to the function when the parameter is added into the helper function. Note that if any content existed prior to the function execution, it will be appended at the end by default. Below is a schematic example of the setup for this kind of function manipulation:

<ON_PRIMARY_DOWN>(* your custom code *)</ON_PRIMARY_DOWN>
<!-- ... -->
<UseParametersFn Name="ASOBO_Append_To_Mouserect_Events_Helper">
    <EV_PARAM>ON_PRIMARY_DOWN</EV_PARAM>
</UseParametersFn>

The following is a more complete example of how these events can be used:

<ParametersFn Name="My_Config_Function">
    <!-- Function code here -->
    <ReturnParameters>
        <ON_INCREASE>1 (&gt;B:#IE_PRESET_ID#_Inc)</ON_INCREASE>
        <ON_DECREASE>1 (&gt;B:#IE_PRESET_ID#_Dec)</ON_DECREASE>
    </ReturnParameters>
</ParametersFn>
<ParametersFn Name="My_Function">
    <!-- Function code here -->
    <Parameters Type="Override">
        <SaveParameters ID="Temp_IE_Save">
            <UseParametersFn Name="ASOBO_Append_To_Mouserect_Events_Helper">
                <EV_PARAM>ON_INCREASE</EV_PARAM>
            </UseParametersFn>
            <UseParametersFn Name="ASOBO_Append_To_Mouserect_Events_Helper">
                <EV_PARAM>ON_DECREASE</EV_PARAM>
            </UseParametersFn>
        </SaveParameters>
    </Parameters>
</ParametersFn>

 

 

Mouserect - Configuration

The following sections show how you can configure some of the default values used for mouse inputs to suit your specific needs.

 

 

Increment / Decrement Events

By default the increment and decrement values are forwarded to the input events (this is controlled by the FORWARD_INC_DEC_TO_IE tag, which can be set to "false" to disable the behaviour). The value sent to the events is 1 by default but can be changed using the MR_TO_IE_INC_VALUE and MR_TO_IE_DEC_VALUE tags.

<Parameters Type="Default">
    <Condition Valid="FORWARD_INC_DEC_TO_IE">
        <MR_TO_IE_INC_VALUE>1</MR_TO_IE_INC_VALUE>
        <MR_TO_IE_DEC_VALUE>1</MR_TO_IE_DEC_VALUE>
    </Condition>
</Parameters>
<Parameters Type="Override">
    <Condition Valid="FORWARD_INC_DEC_TO_IE">
        <ON_INCREASE>#MR_TO_IE_INC_VALUE# (&gt;B:#IE_PRESET_ID#_Inc)</ON_INCREASE>
        <ON_DECREASE>#MR_TO_IE_DEC_VALUE# (&gt;B:#IE_PRESET_ID#_Dec)</ON_DECREASE>
    </Condition>
</Parameters>

 

 

Controller Drag Sensitivity

If you feel like the controller drag interaction is a bit too slow or fast you can set the parameter CALLBACK_DRAG_SCALAR_BOOST which will be multiplied to the CALLBACK_DRAG_SCALAR (which defaults to 1).

 

 

Drag And Animations

The following parameters are useful when it comes to modifying the way that mouse dragging interactions work with the various animations within a behaviour.

 

  • CALLBACK_DRAG_USE_ANIM_LAG

    This parameter defaults to "true" for discrete state interaction and events, and "false" for continuous state interactions. When "true", the animation lag will not be skipped while interacting, which gives a more reactive and responsive feel to the control, so it is sometimes useful to override the default settings.

 

  • CALLBACK_DRAG_ANIM_SYNCED_WITH_DRAG

    This parameter can be set to true to synchronize the animation percentage to the drag value when using trajectory type dragging.

 

 

Animations - Secondary Animations

To add a secondary animation to an interaction you can use the ASOBO_Add_Animation_Helper model behaviour template. Here is an example snippet that illustrates this:

<UseParametersFn Name="ASOBO_Add_Animation_Helper">
    <SaveParameters ID="Append_With_Animation">
        <KEEP_ANIM_LAG_WHEN_INTERACTING>True</KEEP_ANIM_LAG_WHEN_INTERACTING>
    </SaveParameters>
    <ANIM_LAG>300</ANIM_LAG>
    <ANIM_NAME>HANDLING_LEVER_FLAPS_ROD_1</ANIM_NAME>
    <ANIM_CODE>(O:_Interaction_Is_Locked) 100 *</ANIM_CODE>
</UseParametersFn>

Note that any parameter not handled by default by ASOBO_Save_Animation_Helper should be saved to to a file (in the code above, "Append_With_Animation") to make it into the final animation.

 

 

Animations - Transforms

The following is a list of animation transforms that are exposed to you for use through the ASOBO_Process_Anim_Transforms_Parameters templates.

 

  • ANIM_TEST_NO_FAILURE_CODE

    If specified, the ANIM_CODE becomes CODE_WHEN_NO_FAILURE_ACTIVE, ANIM_TEST_NO_FAILURE_CODE becomes TEST_NO_FAILURE and is processed by ASOBO_Failure_Helper. You can also specify CODE_WHEN_FAILURE_ACTIVE which defaults to 0 (false).

 

  • INVERT_ANIM

    if 1 (true), then the animation code is inverted.

 

  • REPEAT_ANIM

    This is used exclusively with ANIM_DURATION and takes the parameter REPEAT_ANIM which contains a value to define how many times the animation should loop.

 

  • ANIM_DURATION

    This is used exclusively with REPEAT_ANIM and takes the parameter ANIM_DURATION which gives the duration of a single run of the animation (from frame 0 to the last frame) in seconds.

 

You can disable the default transforms by setting USE_ASOBO_ANIM_TRANSFORMS to 0 (false) and/or add your own transforms by specifying a function to add them before these ones with PFN_REGISTER_ANIM_TRANSFORM_APPLIED_FIRST or after them with PFN_REGISTER_ANIM_TRANSFORM_APPLIED_LAST. To create a transform function you can use the ASOBO_Animation_Add_Transform_Helper template and then define/override whatever parameter you need.

<Condition Valid="INVERT_ANIM">
    <UseParametersFn Name="ASOBO_Animation_Add_Transform_Helper">
        <TRANSFORM_PFN>ASOBO_Anim_Invert_Parameters</TRANSFORM_PFN>
    </UseParametersFn>
</Condition>
<!-- More Code Here... -->
<ParametersFn Name="ASOBO_Anim_Invert_Parameters">
    <ReturnParameters>
        <ANIM_CODE>#ANIM_LENGTH# #ANIM_CODE# -</ANIM_CODE>
    </ReturnParameters>
</ParametersFn>

Note that you can even add an <update> running alongside your animation with ASOBO_Add_Animation_Update_Helper (the animation index can be accessed by reading the parameter ANIMATION_ID).

 

Finally, you can find some of these same transforms available for emissive and visibility components:

 

 

 

 

Audio - Creating Custom Events

When it comes to audio, it is possible to disable the automatic creation of sound events and then create your own. To disable the automatically created events you would have the following tag:

<AUTO_CREATE_SOUND_EVENTS>False</AUTO_CREATE_SOUND_EVENTS>

Once disabled you can create your own sound events using the ASOBO_Add_Sound_Event_Helper. This function takes the following parameters:

 

  • WWISE_EVENT_DIRECTION

    Direction of the animation this event will trigger for (default: Both)

 

  • WWISE_EVENT_NAME

    Name of the sound event

 

  • WWISE_EVENT_COUNT

    This is used exclusively with WWISE_EVENT_NORMALIZED_TIME and defines the number of sound events to create.

 

  • WISE_EVENT_NORMALIZED_TIME

    This is used exclusively WWISE_EVENT_COUNT and sets the time within the animation when the sound event should be triggered. The time value is given as a Percent Over 100 where 0 is the start of the animation and 1 is the end.

 

NOTE: Animation sound effects can be added using the same logic and the ASOBO_Add_Anim_Effect_Helper. Every parameter is similar except the WWISE_EVENT part of the parameter name, which is replaced by ANIM_EFFECT, eg: WWISE_EVENT_NAME becomes ANIM_EFFECT_EVENT_NAME.