EvaluateComponentSpace_AnyThread not working as intended?

Hi, I’m trying to apply a bvh file I have to a character, and it’s not working as intended.

My plan is to apply the transformations in Component Space and then converting the result back to local space, and apply that to the output pose.

It looks like this.

I defined AnimGraphNode_CustomControl like this



UCLASS()
class CLIENT_API UAnimGraphNode_CustomControl : public UAnimGraphNode_Base
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, Category = Settings)
        FAnimNode_CustomControl Node;
public:
    virtual void CreateOutputPins() final;
};


As you guys now, FAnimNode_CustomControl is where it inherits FAnimNode_Base and applies the animation to the character.

It’s defined as follows.

The header file



USTRUCT(BlueprintInternalUseOnly)
struct CLIENT_API FAnimNode_CustomControl : public FAnimNode_Base
{
    GENERATED_BODY()

private:
    AFastCharacter* Character;

protected:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Links)
        FComponentSpacePoseLink Pose;
public:
    virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
    virtual void Update_AnyThread(const FAnimationUpdateContext& Context) override;
    virtual void EvaluateComponentSpace_AnyThread(FComponentSpacePoseContext& Output) override;
};


In

, I tried to make the neck look longer to the z axis direction. You can look at the following code to see what I mean.

The cpp file



#include "FAnimNode_CustomControl.h"
#include "AnimationRuntime.h"
#include "Animation/AnimInstanceProxy.h"

/*...Removed irrelevant code...*/

void FAnimNode_CustomControl::EvaluateComponentSpace_AnyThread(FComponentSpacePoseContext& Output)
{
    Pose.EvaluateComponentSpace(Output);
    UE_LOG(LogTemp, Warning, TEXT("EvaluateComponentSpace_AnyThread Called"));

    if (Character != NULL && Character->State == 0 && Character->boneTransforms.Num() > 0) {
        UE_LOG(LogTemp, Warning, TEXT("SafeSetCSboneTransforms Called"));

        //Not sure if I have to write this column-wise or row-wise, but I guess row-wise is right?
        FMatrix temp=FMatrix::Identity;
        temp.M[3][0] = 0;
        temp.M[3][1] = 0;
        temp.M[3][2] = 1000;

        //Bone index 6 is where the head bone exists
        Output.Pose.SetComponentSpaceTransform(FCompactPoseBoneIndex(6), FTransform(temp));
    }
}

This is the totally unexpected result.
3.PNG.jpg
It got extended to both the x axis AND the z axis direction!

I want to know why this happened and how I can possibly solve this. Any form of help would be appreciated a lot!!!

(My version is 4.24.1)

You should really update to the latest version of .24 first.
solves a lot of issues.

Secondly. Are you positive on the order of the matrix for a transform?
And wouldn’t you have to feed it the other values as well rather then just the 3rd set?
Do a little test with a completely written out matrix and see if it makes any difference.

Also, it seems like it took 2 dimensions from the image, not 3 with the same value (x and z). Then again it could be just a trick of perspective.

Thanks everyone. It was actually an issue of Maya export into Unreal Engine 4.

And I was surprised to see Unreal is actually row major, not column major. I didn’t know the translation matrix’s 4th row was where the translation had to be, and not the 4th column.