Skip to content
Snippets Groups Projects
Commit b3a6f26a authored by Pin-Hua Ho's avatar Pin-Hua Ho
Browse files

Added facial animation entry in VirtualHuman

parent 81d0af7c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -180,6 +180,24 @@ bool AVirtualHuman::SupportsMorphs() ...@@ -180,6 +180,24 @@ bool AVirtualHuman::SupportsMorphs()
return BodyType != EBodyType::MetaHuman; return BodyType != EBodyType::MetaHuman;
} }
void AVirtualHuman::PlayFacialAnimationMontage(UAnimMontage* InMontage, float InPlayRate, FName StartSectionName)
{
UVHAnimInstance* BodyAnimInstance = GetBodyAnimInstance();
if (BodyAnimInstance)
{
float const Duration = BodyAnimInstance->Montage_Play(InMontage, InPlayRate);
if (Duration > 0.f)
{
// Start at a given Section.
if (StartSectionName != NAME_None)
{
BodyAnimInstance->Montage_JumpToSection(StartSectionName, InMontage);
}
}
}
}
bool AVirtualHuman::ForcePlayNewIdleAnimation() bool AVirtualHuman::ForcePlayNewIdleAnimation()
{ {
if (CustomIdleAnimations.IsEmpty()) if (CustomIdleAnimations.IsEmpty())
......
...@@ -98,6 +98,13 @@ public: ...@@ -98,6 +98,13 @@ public:
virtual EVHGender GetGender(); virtual EVHGender GetGender();
virtual bool SupportsMorphs(); virtual bool SupportsMorphs();
/**
* Facial animation play entry
*/
UFUNCTION(BlueprintCallable)
virtual void PlayFacialAnimationMontage(UAnimMontage* InMontage, float InPlayRate = 1.0f, FName StartSectionName = NAME_None);
/** /**
* Forces a new IDLE animation to be played, which is randomly chosen from "CustomIdleAnimations". * Forces a new IDLE animation to be played, which is randomly chosen from "CustomIdleAnimations".
* Note that the new animation might also be the one which is currently playing. * Note that the new animation might also be the one which is currently playing.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment