# Advanced Interactions On this page we'll go into some details on **advanced interactions** that can be achieved using the model behaviors. This page assumes you have read and understood the basic [Using Model Behaviors](../using-model-behaviours/) and [Creating Cockpit Interactions](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:   {{< table-wrapper >}} | `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 | {{< /table-wrapper >}}   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: ``` xml (* your custom code *) ON_PRIMARY_DOWN ``` The following is a more complete example of how these events can be used: ``` xml 1 (>B:#IE_PRESET_ID#_Inc) 1 (>B:#IE_PRESET_ID#_Dec) ON_INCREASE ON_DECREASE ```     ### 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. ``` xml 1 1 #MR_TO_IE_INC_VALUE# (>B:#IE_PRESET_ID#_Inc) #MR_TO_IE_DEC_VALUE# (>B:#IE_PRESET_ID#_Dec) ```     #### 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: ``` xml True 300 HANDLING_LEVER_FLAPS_ROD_1 (O:_Interaction_Is_Locked) 100 * ``` 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. ``` xml ASOBO_Anim_Invert_Parameters #ANIM_LENGTH# #ANIM_CODE# - ``` Note that you can even add an `` 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:   - `ASOBO_Emissive_Add_Transform_Helper` > `USE_ASOBO_EMISSIVE_TRANSFORMS` - `EMISSIVE_TEST_NO_FAILURE_CODE` - `INVERT_EMISSIVE` - `EMISSIVE_BOOST`   - `ASOBO_Visibility_Add_Transform_Helper` > `USE_ASOBO_VISIBILITY_TRANSFORMS` - `VISIBILITY_TEST_NO_FAILURE_CODE` - `INVERT_VISIBILITY`     ### 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: ``` xml False ``` 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 {{< glossterm >}}percent_over_100{{< /glossterm >}} where 0 is the start of the animation and 1 is the end.   {{< callout context="note" title="NOTE" icon="outline/bulb" >}} 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`. {{< /callout >}}