How to get morph target value on animation?

Hi people!

I’m running tests to implement something in the near future, but to it work I need a simple thing (that I couldn’t make).

I need to read the value of a morph target while an animation is running…

You will understand better watching to this video that I recorded from my testing:

Thanks thanks!

Sorry,It might be a little late but may help somebody:
did you try to use “Get morph target” node in your pawn class?
Lem me know if it works for you.

Oh, yeah, i manage to solve this… unfortunately that’s not right way to get the morph target value be cause it’s getting the value from the SkeletalMesh default pose. In order to get the morph target value from the curve animation you have to do a little of C++ to access the animation curve being played. This way you can get any value in runtime during any animation (from 0 to 1).

1 Like

glad to hear that. and thanks for the information.

Hi Fireapache :slight_smile:
I’m trying to solve the same problem!
If you want to share your solution it would be Super helpful!!
Thanks in advance :slight_smile:

richardek, it’s easy to get this value on C++, you just have to get the animation instance for your character and there you can access MorphTargetCurves.Find(MorphName) and that’s it!

Never used C++ before but managed to get it working :stuck_out_tongue: Thanks Fireapache! :slight_smile:

USkeletalMeshComponent* skelComponent = Cast<USkeletalMeshComponent>(GetOwner()->GetComponentByClass(USkeletalMeshComponent::StaticClass()));
UAnimInstance* animInstance = skelComponent->GetAnimInstance();
TMap<FName, float> tMap = animInstance->MorphTargetCurves;
FString value = FString::SanitizeFloat(tMap["BrowsD_L"]);
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, value);

I put the code in an Actor components tick function and added the component to the skeletal mesh

1 Like

So that no one else find their way to this post and gets stuck trying to figure out how to implement that code for half a day (seriously you need to include the .h and .ccp to make sense of getting that to work for non-programmers) I have found that there are two nodes for the morph targets.

First is Get Morph Target which only gives you the base pose value, but the second one is Get Curve Value that gives you the morph target value during play. You won’t see it if you drag of the mesh because you need to get the Anim Instance for the mesh, There is a screenshot below showing both methods (the one connected gives you runtime values for the morph target).

3 Likes

Thank you everyone. Saved me so many hours