UAnimInstance::SetMorphTarget
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIBlueprintCallableUFUNCTION
Description
Sets the blend weight of a named morph target on the owning skeletal mesh. Used to drive facial expressions, muscle flex shapes, or any blend shape authored in the mesh.
Caveats & Gotchas
- • Morph targets driven via this function will be overridden by any morph target curves playing in the active animation. If you see your values being reset every frame, a running animation is likely writing to the same curve.
- • The name must exactly match the morph target name defined in the skeletal mesh asset (case-sensitive in some engine builds). A typo silently does nothing — no warning is emitted.
Signature
ENGINE_API void SetMorphTarget(FName MorphTargetName, float Value); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MorphTargetName | FName | Name of the morph target as defined in the skeletal mesh asset. | — |
| Value | float | Weight in the range [0.0, 1.0]. 0 is the base shape, 1 is fully morphed. | — |
Return Type
void Example
Drive a smile morph target from gameplay C++
void UMyAnimInstance::SetHappiness(float HappinessAlpha)
{
SetMorphTarget(FName("Smile"), FMath::Clamp(HappinessAlpha, 0.f, 1.f));
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?