Breaking Change Details: Deprecating J_CharacterMovementComponent and JM_AnimVarsComponent

The following is a significant breaking change in upgrading to release v39. If you are using the simplified base classes (i.e. not the deprecated classes with e.g. the Origin or J_ prefixes), you will be affected, and will need to take action.

Does this affect me?

Have a look through the What's changed, and why? section. Some sections may not be relevant to your project; if so, feel free to skip them.

If your character extends e.g. M2_CharacterBase, BP_M2_PlayerCharacter or BP_M2Example_PlayerCharacter, you will be affected at least by the change to the character movement component, even if you are not using any of the deprecated functionality. You will see the following popup when you open your character class. More details on this in Resolving the corrupted CharacterMovementComponent.

If any of these parts are relevant to your project, see How to fix.

What's changed, and why?

The following changes have been made to the M2 character and morpheus actor (M2_CharacterBase and M2M_CharacterBase), meaning that if you are using blueprints based off of those classes, you will be impacted. If you are still using the deprecated character (extending e.g. J_ classes or Origin classes), you will not be affected by this.

Deprecated Anim Vars Component

The existing JM_AnimVarsComponent has now been deprecated, in favour of a stripped back M2M_AnimVarsComponent.

  • The following anim vars have been removed:

    • IsWalking

    • IsDoubleJumping

    • HasBeenLaunched

    • HasLowGravity

    • HasZeroGravity

    • IsMovingInLowGravity

    • IsThrustingUp

    • IsThrustingDown

    • IsBouncing

    • IsSliding

    • IsAiming

  • The following anim vars have been modified: (These have been moved into being custom anim vars. For more details, see Changes to gait speeds& Changes to "combat mode")

    • IsJogging

    • IsSprinting

    • IsInCombatMode

    • IsDead

In the deprecated J_AnimInstance, these are still accessible via the DeprecatedAnimVars variable

Modified ABP_M2_Human

ABP_M2_Human, our default anim instance, has been reparented from J_AnimInstance to M2_AnimInstance, and so no longer uses the deprecated anim vars. The old anim vars are still in use in the deprecated ABP_M2_Human_OId.

Deprecated Character Movement Component

The existing J_CharacterMovementComponent has now been deprecated, in favour of using the native default CharacterMovementComponent.

  • The following features have been removed:

    • The “Custom Movement Mode Primary Asset” system (see Changes to "custom movement")

    • Some minor helper functions, like AddGravityMultiplier and AddGaitSpeedMultiplier

      • These could easily be added in the blueprint level in downstream projects if desired.

  • The following features have been modified:

  • Due to M2_CharacterBase's Character Movement class being changed (from J_CharacterMovementComponent to CharacterMovementComponent), unfortunately assets extending M2_CharacterBase will have their component corrupted. If this affects your character, you will see the following popup when attempting to play or open your asset.

Changes to gait speeds

Gait speeds” are now no longer used as a core concept, and the BPC_CharacterMoveSpeedComponent has been deprecated. If you want to change your character’s walk speed, you can do so directly by calling your character movement component. We have an example of this in BP_M2_PlayerCharacter (for more details, see The Example Character)

Sprinting has been set as a custom variable now, instead of being a core anim var. You can add a similar custom variable for walking if you need it for your project (see Define your own variables)

Changes to "combat mode"

Similar to above, IsInCombatMode and IsDead have been converted to BP custom anim vars, and are used in our M2Extras: CombatExample plugin

Changes to "custom movement"

The deprecated “Custom Movement Mode Primary Asset” system is no longer used. It has not been documented, and has not been actively maintained by MSquared for years.

Note that Unreal’s custom movement modes are still available. Custom physics will need to be provided if so, in the UpdateCustomMovement event on your pawn

For reference - the node on the left is exclusive to the J_CharacterMovementComponent, and so has been deprecated and removed from our base class. The node on the right is native Unreal's way of handling custom movement, and will still be available
A basic representative example of applying phyics to your custom movement mode in the native Unreal way

A diagram of the relevant classes

Knowing the interaction of these classes is not essential, but this information has been provided if you want to know more about how the classes interact.

This diagram shows the changes to the assorted classes, and how they are related:

  • JM_AnimVarsComponent has had a new base class introduced: M2M_AnimVarsComponent, which M2M_CharacterBase now points to

  • J_AnimInstance has had a new base class introduced: M2_AnimInstance, which ABP_M2_Human now points to.

  • BPM_M2Example_PlayerCharacter now uses a BP-level BPMC_M2_AnimVarsComponent, based off of the simplified base class, instead of using the deprecated anim vars.

  • The deprecated BP classes (e.g. the _Origin_ ones) will still point to the J_ classes)

A diagram outlining the various movement and animation components, and how they interact

How to fix

Resolving the corrupted CharacterMovementComponent

The most significant action required is resolving the corrupted character movement component in classes extending M2_CharacterBase. You can fix it by doing the following:

  • Open your actor class.

  • If you see the following popup, that means your movement component was corrupted, and has been regenerated automatically.

    • (This is due to the parent class changing its default CharacterMovementComponent to be the base component rather than previously setting it to J_CharacterMovementComponent).

  • Review your auto-generated character movement component class. Since the movement component had to be regenerated, any manual changes to your previous movement component will have been reset.

    • Unfortunately, you won’t be able to compare changes via the diff, since the diffed version will have also been corrupted. Therefore, the best approach to get your changes to your character movement component class would be to either:

      • Make note of your changes to the movement component prior to the upgrade. You will be able to see any changes from the defaults since they will have the “undo arrow” by the property. Some edge cases to be aware of: FaceLastAccelerationDirection may be off, due to the J_CharacterMovementComponent making changes to this automatically. This should probably be set to true once moving off the J_CharacterMovementComponent. Also, make note of the GaitSpeeds values. Jog would be the default walk speed used, and you may want to re-add sprint to your project.

      • Open a version of the project prior to the upgrade, to compare side-by-side, and add any changes back to the upgraded version of your class.

  • Save your asset once you have reviewed your character. Even if you did not need to modify your movement component, the regenerated asset will need to be saved.

Our recommended approach would be to use the simplified components. Most of the deprecated anim variables, movement component additions and the like are not widely used, and could be re-added in downstream projects if desired.

If you accept the new base classes, and are using the M2_CharacterBase, M2M_CharacterBase and ABP_M2_Human already, all you will need to resolve would be the corrupted movement component (see Resolving the corrupted CharacterMovementComponent).

If there are parts of the old functionality that you want to reintroduce into your project, this can be done at the blueprint level. A potential example would be if you want an equivalent to "gait speeds". We have an example flow of handling this in our M2Example plugin - including setting the movement speed on the native Unreal CharacterMovementComponent, and introducing a custom anim var to replicate the state and animate it for both regular and crowd characters. See Changes to gait speeds

If you want to use the deprecated anim vars, there are a number of places you will need to check:

These components are tightly interlinked, so we strongly recommend switching wholesale, or moving all the componets wholesale back to the deprecated classes. (e.g. if you use the deprecated character movement component, but don't update the anim instance or anim vars, some animations may be missing, or other issues will be encountered)

  • In your BPM, check the AnimVarsComponentClass. Make sure that it extends JM_AnimVarsComponent, or some child of that.

  • In your pawn, check your Character Movement's details panel. Set it back to J_CharacterMovementComponent. (If you want to keep values from before the breaking change, you will need to copy them across as outlined in Resolving the corrupted CharacterMovementComponent, since this step will recreate the component)

  • In your pawn, check the mesh’s AnimClass. It will need to be set to an animation blueprint that extends J_AnimInstance instead of M2_AnimInstance

  • Check your pawn set. In its crowd entry, it will need to point to the a SkeletalAnimatedCrowdData that has the right anim instance

How to test it?

Open your character asset. Then PIE to verify that your character begins play, and moves as expected. If you see the Asset had a corrupted CharacterMovementComponent popup in either of the above steps, you will need to go through the How to fix process.

We recommend also checking the animated crowd (e.g. by testing with multiple clients and setting thePlayerClient.Rendering.NumInLOD0 live config override to 0), to ensure that it is also animating as expected.

If you previously used the J_CharacterMovementComponent, and are not using it any more, you may have compile errors if calling methods that are not present in CharacterMovementComponent. You should also search for attempts to cast to J_CharacterMovementComponent in your project. If there were any, they will fail.

Last updated

Was this helpful?