Page MenuHomeFeedback Tracker

Howto synchronize enfusion animation with RV animation?
Reviewed, UrgentPublic

Description

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.

Details

Severity
Feature
Resolution
Open
Reproducibility
Random
Operating System
Windows 7
Category
General

Event Timeline

Hunterz created this task.May 27 2023, 10:51 AM

not sure if thos envents can be somehow used as workaround:

//!----------------------------------------------------
    // event handling

    //! calls DayZPlayer.OnStepEvent();
    proto native    void RegisterStepEvent(string pEventType, float pFilterTimeout);

    //! calls DayZPlayer.OnSoundEvent();
    proto native    void RegisterSoundEvent(string pEventType, float pFilterTimeout);

    //! calls DayZPlayer.OnParticleEvent();
    proto native    void RegisterParticleEvent(string pEventType, float pFilterTimeout);

Tried this as well:

		PlayerBase player = PlayerBase.Cast(CrewMember( 0 ));
		if (player)
		{
			int boneIndex = player.GetBoneIndexByName("leftfoot");
			vector m4[4];
			player.GetBoneTransformMS(boneIndex,m4);
			Print("BONE " + boneIndex + " POSITION " + m4[0] + "X" +m4[1]+"X"+m4[2]+"X"+m4[3] );
		}

but it not returning any useful values for me

I got hint, that is only possible go opposite way from scripts to enf anim, so I did animation of pedals and then sending value to animgraph where is pedal animation as pose node so all is now synchronized. Thx Jacob Mango.

Geez changed the task status from New to Reviewed.Jun 19 2023, 9:34 AM