Trajectory Generation {{ currentPage ? currentPage.title : "" }}

In order to control motion matching a trajectory needs to be generated based on the user or AI input. This input is fed into the motion matching node in the animation graph.

This trajectory variable is of type ‘Trajectory’ (blueprint) or FTrajectory (C++). It does not matter how it is generated, so long as it is input into the Motion Matching node and that it represents the character movement you desire.

Note: The input trajectory must have a number of trajectory points equal to or greater than the number of trajectory points specified on the Motion Config asset. See Motion Config

This data structure is essentially a list of trajectory points (FTrajectoryPoint).

FTrajectory

  • TrajectoryPoints - (TArray<FTrajectoryPoint>) - A list of trajectory points representing the trajectory defined in the Motion Config module.

FTrajectoryPoint

  • Position (Vector3) - The position of the trajectory point relative to the character

  • RotationZ (float) - The facing rotation of the trajectory point relative to the character

For most users the ‘Trajectory Generator Component’ will be sufficient to handle generation of trajectories at runtime. This is a component that sits on your character’s blueprint and can output a trajectory based on user input.

Manually Creating Trajectory Structure (Not recommended)

It is possible to manually create the trajectory structure with either C++ or blueprint as shown below. However, it is not recommended for beginners. Use the Trajectory Generator Component instead.

Step 1: First create the trajectory variable in the relevant blueprint (probably AnimationBlueprint event graph).

Step 2: Initialize the trajectory with the desired number of trajectory points.

Step 3: Set each trajectory point as desired (should be done each frame)

Note: For C++ users the trajectory can be be made simply by modifying the Trajectory point list and calling the relevant functions on FTrajectory. It is expected that C++ users will be experienced enough to do this without specific instructions. See Data/Trajectory.cpp and Data/TrajectoryPoint.cpp for more details.

{{{ content }}}