unreal.CharacterTrajectoryComponent

class unreal.CharacterTrajectoryComponent(outer: Object | None = None, name: Name | str = 'None')

Bases: ActorComponent

Component for generating trajectories usable by Motion Matching. This component generates trajectories from ACharacter. This is intended to provide an example and starting point for using Motion Matching with a common setup using the default UCharacterMovementComponent. It is expected work flow to extend or replace this component for projects that use a custom movement component or custom movement modes.

C++ Source:

  • Plugin: MotionTrajectory

  • Module: MotionTrajectory

  • File: CharacterTrajectoryComponent.h

Editor Properties: (see get_editor_property/set_editor_property)

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • auto_update_trajectory (bool): [Read-Write] By default the component will always update trajectory. If desired, this can be disabled and the game can choose when to update. For example, a game might want to only update trajectory for characters that are within view or very close to the local player.

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_tags (Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • history_length_seconds (float): [Read-Write] This should generally match the longest history required by a Motion Matching Database in the project. Motion Matching will use extrapolation to generate samples if the history doesn’t contain enough samples.

  • history_samples_per_second (int32): [Read-Write] Higher values will cost more storage and processing time, but give higher accuracy.

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • max_controller_rotation_rate (float): [Read-Write] Maximum controller rotation rate in degrees per second used to clamp the character owner controller desired rotation to generate the prediction trajectory. Negative values disable the clamping behavior

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • prediction_length_seconds (float): [Read-Write] This should match the longest trajectory prediction required by a Motion Matching Database in the project. Motion Matching will use extrapolation to generate samples if the prediction doesn’t contain enough samples.

  • prediction_samples_per_second (int32): [Read-Write] Higher values will cost more storage and processing time, but give higher accuracy.

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • replicate_using_registered_sub_object_list (bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

  • rotate_towards_movement_speed (float): [Read-Write] If the character is forward facing (i.e. bOrientRotationToMovement is true), this controls how quickly the trajectory will rotate to face acceleration. It’s common for this to differ from the rotation rate of the character, because animations are often authored with different rotation speeds than the character. This is especially true in cases where the character rotation snaps to movement.

  • trajectory (PoseSearchQueryTrajectory): [Read-Write] Trajectory stored in world space so it can be directly passed to Motion Matching.

property auto_update_trajectory: bool

[Read-Only] By default the component will always update trajectory. If desired, this can be disabled and the game can choose when to update. For example, a game might want to only update trajectory for characters that are within view or very close to the local player.

Type:

(bool)

get_facing_from_mesh_component(mesh_component) Rotator

This can be used to override the facing used for trajectory calculation.

Parameters:

mesh_component (SkeletalMeshComponent) –

Return type:

Rotator

property history_length_seconds: float

[Read-Only] This should generally match the longest history required by a Motion Matching Database in the project. Motion Matching will use extrapolation to generate samples if the history doesn’t contain enough samples.

Type:

(float)

property history_samples_per_second: int

[Read-Only] Higher values will cost more storage and processing time, but give higher accuracy.

Type:

(int32)

property max_controller_rotation_rate: float

[Read-Only] Maximum controller rotation rate in degrees per second used to clamp the character owner controller desired rotation to generate the prediction trajectory. Negative values disable the clamping behavior

Type:

(float)

property prediction_length_seconds: float

[Read-Only] This should match the longest trajectory prediction required by a Motion Matching Database in the project. Motion Matching will use extrapolation to generate samples if the prediction doesn’t contain enough samples.

Type:

(float)

property prediction_samples_per_second: int

[Read-Only] Higher values will cost more storage and processing time, but give higher accuracy.

Type:

(int32)

property rotate_towards_movement_speed: float

[Read-Only] If the character is forward facing (i.e. bOrientRotationToMovement is true), this controls how quickly the trajectory will rotate to face acceleration. It’s common for this to differ from the rotation rate of the character, because animations are often authored with different rotation speeds than the character. This is especially true in cases where the character rotation snaps to movement.

Type:

(float)

property trajectory: PoseSearchQueryTrajectory

[Read-Only] Trajectory stored in world space so it can be directly passed to Motion Matching.

Type:

(PoseSearchQueryTrajectory)

update_trajectory(delta_seconds) None

This can be called when bAutoUpdateTrajectory is false to manually control when trajectory updates.

Parameters:

delta_seconds (float) –