Disable Root Motion at Runtime

Create a new C++ class (right-click within the content browser). Make sure “Show All Classes” is checked. Choose Parent Class: “AnimInstance”

And below the “public:” line in your newly created .cpp file, add the following method (not tested, but this should work)

    UFUNCTION(BlueprintCallable)
    void EnableRootMotionMode(bool bEnable)
    {
        if (bEnable)
        {
            this->RootMotionMode = ERootMotionMode::RootMotionFromMontagesOnly;
        }
        else
        {
            this->RootMotionMode = ERootMotionMode::IgnoreRootMotion
        }
    }

i hope this helps, cheers!

1 Like