Example #1
0
bool Animator::isAnimationRunning(Entity* object, const std::string& animationName)
{
	AnimationComponent* animationComp = object->getComponent<AnimationComponent>();
	if(animationComp && animationComp->isValid())
		return animationComp->isAnimationRunning(animationName);
	return false;
}
Example #2
0
void Animator::animate(Entity* object, float step)
{
	AnimationComponent* animationComp = object->getComponent<AnimationComponent>();
	SkeletonComponent* skeletonComp = object->getComponent<SkeletonComponent>();
	if(!skeletonComp || !skeletonComp->isValid())
		return;

	if(!animationComp || !animationComp->isValid())
	{
		skeletonComp->initToBindPose();
		return;
	}

	animationComp->updateAnimations(step);

	if(!animationComp->isAnimationRunning())
		return;

	std::vector<JointPose> blendPose(skeletonComp->getNbJoints());
	animationComp->blendAnimations(blendPose);
	animationComp->cleanAnimationTracks(step);

	skeletonComp->computePose(blendPose);
}