09 - Motion Warp





Motion Warping is a feature where you can dynamically adjust a character's root motion to align to targets. This document will show you how to create the Motion Warping logic in your character blueprint, assign Motion Warping windows within animation montages, and link them to named positions.

Prerequisites

In order to use Motion Warping, you must meet the following prerequisites:

  • You must enable the Motion Warping plugin. To do this, navigate in the Unreal Editor menu bar to Edit > Plugins and navigate to Built-In > Animation Motion Warping. Ensure the plugin is enabled and restart the editor.



  • Motion Warping utilizes Blueprint and Animation Montage workflows. Therefore, you should have an understanding of these features.

  • You have Character Blueprints, Inputs, and Animations in your project that you can create gameplay examples with.

Understanding Motion Warping

The overall feature for Motion Warping can be broken down into 2 main areas: Animation Montage and the Blueprint logic for the Motion Warping Component.

Using the Animation Montage asset, you can create Motion Warping Windows with the Anim Notify States.



In Blueprints, you can use the Motion Warping component to assign sync points and play the montage.



Motion Warping Notify States

Animation Montages are where you will specify the Motion Warping areas and customize their behavior. This is done through the Motion Warping Notify State. After adding the Motion Warping Notify State to your montage, you can then manually line up the state duration to where you want the warping to occur during the animation.

For example, in this mantling montage, you will likely need to ensure your starting warp region covers the duration when the character places its hand on the obstacle.

mantling montage example

To create a new Motion Warping region, right click on one of the Notifies tracks and select Add Notify State > Motion Warping.



Anim Notify Details

The Anim Notify Details panel contains properties necessary for your Motion Warping to function. Click on the Motion Warping notify keyframe to reveal these details.



Detail Name

Description

Root Motion Modifier Config

The Motion Warping type to specify.

Sync Point Name

The name used to find this sync point. Correlates to the Add or Update Sync Point Blueprint Node.

Warp Translation

Whether to warp the translation component of the root motion.

Ignore ZAxis

Whether to warp the Z (Up/Down) component of the translation.

Warp Rotation

Whether to warp the rotation component of the root motion.

Rotation Type

Whether the rotation should warp to match the sync point's rotation or face the sync point.

Warp Rotation Time Multiplier

Modifies how fast the rotation is warped. For example, if the Motion Warping window lasts for 2 seconds, and this property is 0.5, then the final rotation will be reached in 1 second.

Notify Color

Sets the color of the Motion Warping notify keyframe.

Motion Warping in Character Blueprints

You can use the Motion Warping component and nodes in your Blueprints to trigger the warp, and specify sync points.

Motion Warping Component

You must add a Motion Warping Component to your Blueprint to enable Motion Warping behavior. To do this, click Add+ in the Components panel, and select Motion Warping by searching or locating the component under the Movement category.



The component can now be referenced in your Blueprint graph by dragging and dropping it from the Components panel to the Graph.

Motion Warping Nodes

There are several Blueprint nodes located within the Motion Warping category: Add or Update Sync PointAdd Root Modifier, and Bind Event to On Pre Update.

Name

Image

Description

Add or Update Sync Point



This node links the Sync Point name, which is defined in the Montage asset, to a location. The Sync Point pin can be split into separate Translation and Rotation pins by right-clicking it and selecting Split Struct Pin. Conversely, you can use the Remove Sync Point node to unlink the Sync Point Name.

Add Root Motion Modifier



This node generates new Motion Warping windows with Blueprints instead of adding Anim Notifies in the Montage Asset. Settings for this Motion Warping Window can also be assigned here, such as Start/End Time and Sync Point Name. Nodes for the other Motion Warping types are also available, such as Adjustment BlendScale, and Skew.

Bind Event to On Pre Update



This node allows for binding a custom event to the Pre Update tick of the Motion Warp, whenever a Motion Warp is occurring. Conversely, you can use the Unbind Event from On Pre Update node to unbind the custom event.

Motion Warping Example

In this example, you will learn how to apply Motion Warping so your character can warp to punch a target.

Warping Disabled

motion warping disabled

Setting Up Your Project

Before you begin, you need to enable Root Motion and set up your target location.

To ensure Root Motion is enabled on your animation, open the Animation Asset and check the EnableRootMotion flag.



With Root Motion enabled, now you need to add a target location for your character to warp to. In this example, we will use a Cylinder for the location of the target.

First, if you haven't already, go to the Basic actors and add a cylinder to your level. Then, to set your target, go to the Place Actors panel, and select All Classes. Then, add a Target Point, and make sure it is aligned and rotated to your desired warp point.



Setting up your Montage

Next, you will create an Animation Montage Asset.

  1. From the Content Browser right-click on your animation asset and select Create > Create AnimMontage. Then, name and open the montage asset.



  2. In the montage under Notifies, add a Track. Then, within the track, right-click to Add Notify State... > Motion Warping.



  3. Manually drag the track bar to extend or shorten the duration of the warping. You want to set the range so it begins near the start of the animation, and ends at the moment the character strikes. You can also hold down the Shift key as you move your notify keyframes to preview the animation.



  4. Select the Motion Warping keyframe and navigate to the Details panel to set several properties: .

    • Set Root Motion Modifier Config to Simple Warp. This is done to specify the type of warp.

    • Set a name for Sync Point Name. This is done to identify this warp with a name.

    • Set Ignore ZAxis to false. This is done to not have the character be affected by the vertical position of the warp point.



Character Blueprint Target Setup

Next, you need to add the target to the Character Blueprint.

  1. In the Event Graph, right-click and add an InputAction node mapped to your desired input action. For this example, we will use the Punch event. You can also find InputAction by navigating to Input > Action Events.



  2. Drag the Pressed pin out and add a Get All Actors of Class function. Set the Actor Class to Target Point.


  3. Right-click and add a Get(a copy) node and connect it to the Out Actors array pin. Then, create a Get Actor Location function and connect the Target pin to the Get node's output pin.



Creating a Sync Point

Lastly, we need to create the sync point for getting your Target Point's location.

  1. Add the Motion Warping Component to your Character Blueprint from the Components panel, and select Add > Movement > Motion Warping.



  2. Drag and drop the Motion Warping Component from the Components panel into the Graph.

  3. From the Motion Warping reference, drag off the pin add an Add or Update Sync Point node. Then, hook the input event pin into the preceding Get All Actors of Class node. Then, add a Name to the pin based on the**Sync Point Name** you defined earlier in the Montage. In this example, the Name is Punch.



  4. Right-click on the Sync Point pin and select Split Struct Pin to convert this into a dual Location/Rotation pin structure. Then, connect the Get Actor Location�s Return Value pin to the Sync Point Location pin.



Setting Up Play Montage

Lastly, you need to reference your Skeletal Mesh component in the graph, and play the montage on it.

  1. Drag and drop the mesh component into your graph.

  2. Right click in the graph and add a Play Montage node. Then, assign your mesh asset to the Montage to Play pin.

Results

When you play your level your character will warp to the appropriate point as the punch animation plays.



Comments