Skip to content
Snippets Groups Projects
Commit 850707fa authored by Jan-Nikjas Hartmann's avatar Jan-Nikjas Hartmann
Browse files

Tried to solve the issue of custom idle animation blending by implementing a...

Tried to solve the issue of custom idle animation blending by implementing a new value that can be set for each agent individually
parent eb26c8ed
No related branches found
No related tags found
No related merge requests found
......@@ -298,8 +298,8 @@ void AVirtualHuman::PlayRandomIdleAnimation()
{
float BlendTime = 0.25f;
UAnimMontage* DynamicMontage = GetBodyAnimInstance()->PlaySlotAnimationAsDynamicMontage(IdleAnim, "CustomIdleSlot", BlendTime, BlendTime);
// start timer for next random pick (make it a bit shorter to allow for blending)
GetWorld()->GetTimerManager().SetTimer(NextIdleTimerHandle, this, &AVirtualHuman::PlayRandomIdleAnimation, DynamicMontage->GetPlayLength()- 1.0*BlendTime, false);
// start timer for next random pick (make it a bit shorter to allow for blending, but only by a defined minimal amount for the animations)
GetWorld()->GetTimerManager().SetTimer(NextIdleTimerHandle, this, &AVirtualHuman::PlayRandomIdleAnimation, DynamicMontage->GetPlayLength()- fmin(2.0*BlendTime, (DynamicMontage->GetPlayLength())*MinBlendTime), false);
}
else
{
......
......
......@@ -114,8 +114,11 @@ protected:
//custom idle animations can be specified to be used (played in the DefualtSlot)
//CAUTION: this currently does not work together with walking or pointing
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualHuman|Custom Idle Animations")
TArray<UAnimSequence*> CustomIdleAnimations;
//The minimal percentage of the animation that is allowed to be skiped to blend into another animation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualHuman|Custom Idle Animations")
float MinBlendTime = 1.0;
private:
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment