About Store Forum Documentation Contact



Post Reply 
jumping --> chained animation?
Author Message
Fluxor Offline
Member

Post: #1
jumping --> chained animation?
Hey there,

and another one:

I usually create my jump animations in three parts:

startedJumping? ---> jumpStart.anim
inAir? -> jumpLoop.anim
isGrounded? --> jumpLanding.anim

How can I do this in Esenthel?
Is this possible with the Game.chr?
Or do I have to roll my own custom class?
And how do I chain animations?
08-27-2021 02:59 PM
Find all posts by this user Quote this message in a reply
KrysleQuinsen Offline
Member

Post: #2
RE: jumping --> chained animation?
I do something like this with Animation Blending. (See Tutorial 10-Animation\03 - Blending)
Code:
void Chr.animation()
{
         skel.updateBegin().clear();
/*** other basic animation **/
         skel.animateReplace(jumpLanding.anim, jump_land_time, jump_land_blend)
             .animateReplace(jumpStart.anim, jump_up_time , jump_up_blend*(1-jump_loop_blend))
             .animateReplace(jumpLoop.anim, Time.time(), jump_loop_blend)
}
Code:
void Chr.jumpStart()
{
         ctrl.update(ctrl.actor.vel(), ctrl.crouched(), jump_height);
         jump_up_blend=0;
         jump_up_time=0;
}
Code:
virtual bool   Chr.update(      )
{
         bool is_on_ground=ctrl.onGround(),
                on_air    =!ctrl.onGround();
         C flt TD=Time.d()*4;
         AdjustValBoolSet(jump_up_blend   , on_air,  is_on_ground, TD);
         AdjustValBool     (jump_loop_blend , on_air, TD);
         AdjustValBool     (jump_land_blend  , on_air, TD, TD);
         if(is_on_ground) // landing
         {
                  jump_up_time         =0;
                  jump_land_blend     =0;
         }
         jump_up_time  +=    on_air           *Time.d();
         jump_land_time+=    is_on_ground *Time.d();
}
All other variables are flt.

This is a snippet of my longer code (and more complex) and may not fully work here, but you should get the idea. smile
(This post was last modified: 08-27-2021 05:16 PM by KrysleQuinsen.)
08-27-2021 04:55 PM
Find all posts by this user Quote this message in a reply
Fluxor Offline
Member

Post: #3
RE: jumping --> chained animation?
Awesome, that helps. Thanks!
08-27-2021 05:09 PM
Find all posts by this user Quote this message in a reply
Post Reply