Animation Matching is currently only supported on Characters with Skeletal Meshes using UE4_Mannequin_Skeleton as its skeleton.
Typical Use Cases
Some animations will no longer match each other if they are played on skeletal meshes with proportions that are different from the one used for animating.
The Animation Matching feature attempts to remedy this mismatching by a certain extent. If Animation Matching is enabled, the Grapple Component will move the location of certain bones in the owner's skeletal mesh to match the position of certain other bones in the skeletal mesh associated with another Grapple Participant.
Virtual Mesh Actor
Animations can appear mismatched when they are played on skeletal meshes that have different proportions than the skeletal meshes the animations were originally created in. The Grapple Component can attempt to resolve this mismatching by moving the relevant bones based the Skeletal Mesh on one Participant, based on the Skeletal Mesh of another Participant.
This is done by internally creating an 'ideal scenario', where all relevant animations are being played on their original skeletal meshes. The Grapple Component then takes the relative bone locations from this 'ideal scenario', and applies them to the non-ideal scenario that is taking place in the Grapple Sequence.
The original skeletal meshes mentioned above are added into the game world using a Virtual Mesh Actor. This Actor has the following properties:
- It is a Skeletal Mesh Actor (child of SkeletalMeshActor).
- Is attached to the character's Skeletal Mesh Component
- It has a Skeletal Mesh Component (inherited from class SkeletalMeshActor). The following properties of this Skeletal Mesh Component are especially relevant.
- Skeletal Mesh - The Skeletal Mesh Component has its skeletal mesh set to the skeletal mesh that was used to create the animation.
- Animation - The Skeletal Mesh Component has an Animation Blueprint that copies all animation sent from the Grapple Component to the main Character Mesh. In consequence, it will always have the 'raw' pose of the Character as intended by the Grapple Component. By default, its Anim Instance class is set to be the same one that is used as a Linked Anim Graph on the Character's own Animation Blueprint (in this case used 'standalone' Animation Blueprint instead of a Linked Anim Graph).
- Visibility - The Skeletal Mesh Component has its visibility set to false by default. It is only made visible when its bone locations are relevant for the Grapple Component.
- Material - Even when the visibility of the Skeletal Mesh Component is set to true, all materials are set to be an invisible material by default. If debug info is enabled on the Grapple Component, the Skeletal Mesh Component will use a white x-ray material instead (see image below: al Virtual Meshes are set to the Mannequin in its original scale, and are assuming the reference pose because the Grapple Component does not have any animation active).
Animation Matching Settings
Bones will be moved based on the Animation Matching Settings provided by the user. These settings can be set in the following ways:
- To set the Animation Matching Settings for the duration of a Grapple Sequence, set them in the Global Grapple Data of your Grapple Object.
- To change the settings manually, use function Update Animation Matching on the Grapple Component.
- To update the settings based on animation playback, use Animation Notify AnimNotify_Grapple_UpdateAnimationMatchingSettings in your animation asset.
Animation Matching Data
All of these input methods require the input of Animation Matching Data. This data comes in the form of a variable structure of type struct_GC_AnimationMatching, which contains a set of instructions on how to adjust the animation on the Owner Skeletal Mesh Component in order to match the animation on other Participants. Essentially, the member variables specify the following:
- which bones are being affected;
- based on which bones on the other Participant they should be moved; and
- which other Participant to base these corrections on.
|Retargeted Bone||The bone that is actually being moved by the Grapple Component.|
|Reference Bone||If no Reference Bone is set, the Retargeted Bone will act as the Reference Bone.|
The name of the bone/socket that the reference bone should keep a 'correct position' to. This 'correct position' is calculated by taking the relative locations of these bones on the respective character's Virtual Meshes, and then applying it to the actual Character meshes in the game world.
The master bone name can also refer to a socket.
|Target Position||The position of the reference bone relative to the master bone.|
Bones that can be subject to Animation Matching
Animation matching on the limbs is done by creating a two bone IK chain. The effector location will be the calculated so that the reference bone will be in the target position relative to the master bone.
A location for the joint target (ie. the target location of the knee/elbow) will also be calculated based on the pose of the Virtual Mesh.
Animation matching on the hands and feet will thus affect multiple bones on the limb (more specifically the thigh, calf and foot bone for the legs and the upperarm, lowerarm and hand bones on the arms.
Animation matching on the pelvis is applied moving the pelvis (=retargeted bone) in such a way that the reference bone will be at the target position compared to the master bone.
Animation matching on the pelvis will eventually affect all deform bones on the Skeletal Mesh, as they are all below the pelvis in the bone hierarchy.
Animation Matching Data
|Enabled||Whether Animation Matching should be processed by the Grapple Component.|
|Get blend value from animation curve|
Whether the Blend Value for the Animation based should be based on the value of Animation Curve AnimationMatching on the animation asset that is currently playing.
Animation Curves can de added and edited in the Animation Editor.
For more information on Animation Curves, please refer to the relevant section in the documentation of the Engine.
|Blend Time||Blend time between the pose with and without Animation Matching.|
|Reference Participant Index||The Participant to adjust the animation to.|
Pelvis Master bone
Pelvis Reference Bone
Retarget Right Hand
Right Hand Master Bone
Retarget Left Hand
Left Hand Master Bone
Retarget Right Foot
Right Foot Master Bone
Retarget Left Foot
Left Foot Master Bone
Retarget [none name]: whether to adjust the bone.
[Bone name] master bone: the name of the bone/socket that the retargeted bone should keep a 'correct position' to. This 'correct position' is calculated by taking the relative locations of these bones on the respective character's Virtual Meshes, and then applying it to the actual Character meshes in the game world.
Pelvis reference bone: The pelvis can be repositioned in such a way that another bone maintains the 'correct position' relative to the other Character.