I did bicycle mod with custom animations of player. But need somehow synchronize animation of legs with animation of pedals. Right now using GetThrust() to get information that player pressing W while riding bicycle. Unfortunately that is not fully sync. Can you please provide some hints howto synchronize anim of player and bicycle? For example steering of vehicle is somehow done, but pedalling is loop anim.
I am now using this code in my bicycle base class:
override void EOnPostSimulate( IEntity other, float timeSlice ) { //Print("GET THRUST " + GetThrust()); //Print("TURBO " + GetThrustTurbo()); if ( GetGame().IsClient() || !GetGame().IsMultiplayer() ) { if ( m_Pedalsphase > 1 ) { m_Pedalsphase = 0; SetAnimationPhaseNow( "Prevodnik", m_Pedalsphase ); SetAnimationPhaseNow( "Slapka_prava", m_Pedalsphase ); SetAnimationPhaseNow( "Slapka_leva", m_Pedalsphase ); } if (GetThrust() > 0.25) { m_Pedalsphase = m_Pedalsphase + 0.0157; } else { m_Pedalsphase = 0; SetAnimationPhaseNow( "Prevodnik", m_Pedalsphase ); SetAnimationPhaseNow( "Slapka_prava", m_Pedalsphase ); SetAnimationPhaseNow( "Slapka_leva", m_Pedalsphase ); } SetAnimationPhase( "Prevodnik", m_Pedalsphase ); SetAnimationPhase( "Slapka_prava", m_Pedalsphase ); SetAnimationPhase( "Slapka_leva", m_Pedalsphase ); } }
Some video how it works:
Another issue is howto synchronize that other players see that pedals move... I tried run that postsimulate at server as well but there was visual desync, thats why running on client now.
I thinked about events, but in animgraph for player are only sound events and i am not sure if I can mod that class and make some workaround.
Another guess is do it similar way like are done weapons, those anims must be synchronized as well.
Please help me move bicycle mod to next level.