The Grapple Component processes animation instructions when the Update Animation (Input) function is called. These animation updates are processed in the Linked Anim Instances of the Grapple Component. By default, this is the Linked Anim Graph that has been placed in the Character's Animation Blueprint.
These animation instructions are stored in a variable structure called struct_GC_AnimationData.
Member variable type Enum_GC_AnimationType
Specifies the type of animation to be used (Anim Sequence, Blendspace or Animation Montage).
|Montage - Asset||In case Montage is selected under Animation Type, the Animation Montage asset that will be used is selected here.|
|AnimSequence - Asset||In case Anim Sequence is selected under Animation Type, the Anim Sequence asset that will be used is selected here.|
|Blendspace - Asset||In case Blendspace is selected under Animation Type, the Blendspace asset that will be used is selected here.|
|Blend time||The desired blend time between animations.|
|Start Time||The initial position of the animation (in seconds)|
|Play Rate||The play rate of the animation|
|Loop||Whether the animation should loop (start over when it is finished)|
|Force restart animation||Whether to force the animation to restart if the same asset is already playing|
|Root Motion Enabled||Whether to enable root motion during the animation.|
|Montage - Section - Jump To||In case Montage is selected under Animation Type, the section to jump to. If this member variable is set to 'none' the section will remain unchanged.|
|Montage - Section - Set Next - Updated Section||In case Montage is selected under Animation Type, the function Montage Set Next Section will be called on the Animation Blueprint. This member variable will be passed on to the parameters of this function. It should contain the name of the section that needs to be changed.|
|Montage - Section - Set Next - Desired Section|
In case Montage is selected under Animation Type, the function Montage Set Next Section will be called on the Animation Blueprint. This member variable will be passed on to the parameters of this function. It should contain the name of the next section.
This enumeration is used to select the type of animation update we want to process when playing animation from the Grapple Component. These modes act as 'channels' that the Animation Blueprint switches between. On a technical level, animation is processed differently based on the type of asset being used (Animation Sequence, Animation Montage or Blendspace).
|Stop All||Stop all animation currently being played by the Grapple Component.|
|AnimSequence||Use an Animation Sequence as the source for the animation. This can be user-friendly because external animation assets are typically imported into the Engine as Animation Sequences.|
|Montage||Use an Animation Montage as the source for the animation. Montages are the most suitable way to create a Grapple sequence. They support the use of Montage Slots, Sections, and are more stable in multiplayer projects They also enable users to combine and selectively play animations that are contained in a single asset.|
|Blendspace||Use a Blend Space as the source for the animation. Blend Spaces are assets that allow any number of animations to be blended between based on the values of multiple inputs.|
Do not change the animation.
Generating Animation Data
Animation Data can be generated using a Make struct_GC_AnimationData node. This node contains all of the pins that make up the Animation Data.
Alternatively, it is possible to use any of the following Macros:
- Macro - Make Animation Data (Montage)
- Macro - Make Animation Data (Montage + Section)
- Macro - Make Animation Data (Anim Sequence)
- Macro - Make Animation Data (Blendspace)
- Macro - Make Animation Data (Stop All)
- Macro - Make Animation Data (Unchanged)
Animation can be updated through the Grapple Component by using node Update Animation (Input). During a Grapple Sequence, it is also possible to update Animation Data on multiple Participants using node Update Animation for Multiple Participants (Input).
These events take the input of a struct_GC_AnimationData variable structure, either in the form of a single variable or an array.
The Grapple Component can play Blendspaces on its Animation Blueprint and can generate coordinates for said Blendspaces. These coordinates can be synchronized between Participants.
How to use
To start playing a Blendspace, update animation using node Update Animation (Input) on the Grapple Component, setting the animation mode to Blendspace.
Blendspaces can be generated by the Grapple Component using function Generate Blendspace Coordinates. This function has the following parameters:
|Coordinate Input Mode||The basis from which Blendspace Coordinates are generated. For more information on these modes, see the section on enumeration Enum_GC_BlendspaceCoordinateInputMode.|
|Reference Grapple Component||The Grapple Component we should evaluate when generating Blendspace Coordinates. |
|Send to Animation Blueprint||Whether the generated coordinates should be used immediately by the Animation Blueprint.|
|Apply to All Participants||Whether to send the coordinates over to all other Participants in the Grapple Sequence.|
Coordinates can also be set directly using node Set Pending Blendspace Coordinates. They can be accessed using function Get Pending Blendspace Coordinates.
Generating Blendspace Coordinates during Grapple Sequence
- It is possible that you need a Grapple Sequence to generate Blendspace Coordinates while it is active. This can be done by going through the following steps.
- In the Class Defaults tab of your Grapple Object, set variable Should Receive Tick (found under the Status Object - Settings category) to true. This will cause the Grapple Component to enable ticking, and to send over a tick event to the Grapple Object, as long as this Grapple Object is active.
Implement the On Tick Received event in your Grapple Object (this is done by adding the Event On Tick Received node in the Grapple Object's Event Graph. This Event can then be connected to a Generate Blendspace Coordinates node that is executed on any Participant.
The enumeration Enum_GC_BlendspaceCoordinateInputMode describes how Blendspace coordinates are generated by the Grapple Component.
Coordinates are generated in the graph of function Generate Blendspace Coordinates.
These descriptions often mention a Reference Grapple Component. This is the participant specified under struct_GC_AnimationData that will be the source used for calculating Blendspace coordinates.
|None (set manually)||The Grapple Component will not generate coordinates for the Blendspace. The event Update Blendspace Coordinates can be used to set coordinates manually.|
|Local Movement Direction||Use the direction the Reference Grapple Component is moving in (relative to its world rotation).|
|Local Look Direction||Use the direction the Reference Grapple Component is looking at (relative to its world rotation).|
|Controller Movement Input||Use the current movement of the Reference Grapple Component's controller .|
|Controller Look Input||Use the current look of the Reference Grapple Component's controller .|
|Delta Rotation (current - last)||The rotation of the Reference Grapple Component, compared to the rotation during the last update.|
|Delta Rotation (target - current)||Use the current control rotation on the Reference Grapple Component's controller, compared to the current rotation of the Reference Grapple Component.|
|Copy from other participant||Copy the Blendspace coordinates currently used by the Reference Grapple Component.|
|Speed and Direction|
X-axis represents the local direction the character is moving in; Y-axis represents the current velocity relative to Max Walk Speed on the Character Movement Compoent.
Linked Anim Instances
The Grapple Component sends animation updates over to all of its Linked Anim Instances. These are Animation Blueprints that are able to respond to animation related instructions from the Grapple Component. They are added automatically if the Grapple Component has been implemented following the steps in the Implementation tutorial in the documentation.
The following functions can be used to access the Linked Anim Instances:
- Get Linked Anim Instances
- Add Linked Anim Instance
- Remove Linked Anim Instance
Switching animation assets based on the target Skeleton
The first way is to add a Selection Condition that filters Participants based on the Skeleton used by their Linked Skeletal Mesh
The second way is to use the same grapple data, but replace references to animation assets to those of their respective counterparts for other skeletons. Store references for your Grapple animations to all of their counterparts for different skeletons. This can be done using an Object Converter Blueprint using the following steps:
1. Create a child class of ObjectConversion_StoredData. For the purposes of this tutorial, we will call this child object AnimationRemappingData.
2. Open AnimationRemappingData in the editor and modify its variable Modifier Mappings.
3. This variable contains references to objects and the object they should be converted to, based on a certain Modifier Object. In this case, the input obects are the animation assets, and the command is the skeleton that should be used.
An example of this last step is shown on the image below. Montage a_grapple_spinningkick_00_Montage will be converted to RTG_a_grapple_spinningkick_00_Montage if the Modifier Object is TutorialTTP_Skeleton.
The Grapple Component only needs this data, and will make sure animation references converted based on the right input.
4. On the Grapple Component, set the Object Converter Blueprint Class variable to a reference to class AnimationRemappingData. This will make sure the Grapple Component is actually using the data we have stored previously.