Animation bledning problem

Posted By: Ch40zzC0d3r

Animation bledning problem - 06/25/13 14:37

Hey guys.
Today I tried to blend my animations to get a better result in endgame. However, in firstperson I got everything to work but in thirdperson it doesnt work, because I use ANM_ADD too:
Code:
if(mv_lastMode != 1) mv_fpsBlend = 0;
mv_lastMode = 1;
ent_blendframe(pLocal, pLocal, "stand", 0, mv_fpsBlend);
mv_fpsBlend = clamp(mv_fpsBlend + 4*time_step, 0, 100);
if(mv_fpsBlend >= 25)
{
	ent_animate(pLocal, "stand", mv_fpsAnim, ANM_CYCLE);
	mv_fpsAnim += 3*time_step;
}
else
{
	mv_fpsAnim = 0;
}

.......

ent_animate(pLocal, "r_pose", 0, ANM_ADD); //<- this results in a weird behaaviour while the first 25% of the frame is blending :(



I hope someone can help me a little laugh
Thanks in advance!
Posted By: Anonymous

Re: Animation bledning problem - 06/25/13 19:37

manual
Quote:
ent_animate(entity,NULL,0,0) resets all bones poses of the entity


manual ent_animate code example
Code:
// reset skeletion and then compose the animation (order is important): 
      ent_animate(me,NULL,0,0); // reset all bones
// first, shake the arms during running
      ent_animate(me,"run_torso",my.skill1,ANM_CYCLE);
// then blend over to, or blend back from shooting (only affects the arms)
      if (my.skill3 > 0) { ent_blend("shoot",0,my.skill3); }
// finally animate the legs (only affects the legs)
      ent_animate(me,"run_legs",my.skill2,ANM_CYCLE+ANM_ADD);




Of course I'm still half asleep so I might misunderstand your question.
Posted By: Ch40zzC0d3r

Re: Animation bledning problem - 06/26/13 14:53

Doesnt work frown
Here is a ready to use example:
http://www.mediafire.com/?sufdhy9syhk5uu6
Posted By: Anonymous

Re: Animation bledning problem - 06/26/13 17:40

It works just like it should, But there is a little odd pop in it, that I think would be fixed by putting the blend into a if() block.


Code:
while(1)
	{
		ent_animate(me,NULL,0,0); 
		if(key_w)
		{
			mv_lastMode = 2;
			ent_animate(me, "walk", animationCount, ANM_CYCLE);
			animationCount += 5*time_step;
		}
		else
		{
			//ent_animate(me,NULL,0,0);/// NOT NEEDED 
			ent_animate(me, "walk", animationCount, ANM_CYCLE);
			if(mv_lastMode != 1) mv_fpsBlend = 0;
			mv_lastMode = 1;
			ent_blendframe(me, me, "stand", 0, mv_fpsBlend);
			mv_fpsBlend = clamp(mv_fpsBlend + 3*time_step, 0, 100);
			
			if(mv_fpsBlend >= 25)
			{
				ent_animate(me, "stand", mv_fpsAnim, ANM_CYCLE);
				mv_fpsAnim += 3*time_step;
			}
			else
			{
				mv_fpsAnim = 0;
			}
		}
		
		 ent_animate(me, "r_pose", 0, ANM_ADD); //Comment out this line to see the expected result
		
		
		wait(1);
	}




EDITED
Posted By: Ch40zzC0d3r

Re: Animation bledning problem - 06/26/13 18:10

Thanks, I tried exactly the same code before and it didnt work as expected xD
However, now its working tongue
Posted By: Anonymous

Re: Animation bledning problem - 06/26/13 18:30

Your welcome , It seemed a odd question. You already knew the answer.

You can remove the second empty ent_animate() inside the else. Also I didn't try but you should be able to do the logic on the animation variables in the if()else() blocks and then put all the animation instructions in a block at the end with a little logic, like the example from ent_animate.

EDIT* Looking at the manual I think the ent_blendpose() would end up being better as you can compose pose layers. It looks like you are going to end up with many ANM_ADD's like Shooting, Reloading, Middle-finger-in-the-air grin , ect...
© 2024 lite-C Forums