Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Synchronisation Annimation via RPC call

$
0
0
Hello,

I'm looking since 1 week a way to synchornise my annimation via a RPC call.

I have my two player connect in my game.
One of them is punching , so he is playing the annimation "Punch".
I would like the other player to see him punching but without having to put code in the "OnPhotonSerializeView()" function because this action doesn't have to be synchronise every frame but only when the player is pressing a key.

For the moment i have this code .

I read the input and play the annimation and start a coroutine to say when the punch is finish ( at the end of the annimation):
                if (InputManager.Instance.IsPassing && !hasBall && view.isMine)
{
pc.SetParameterBool("Kick", true);
Invoke("AttaqueFinish", pc.GetTimeCurrentAnAnim(1));
}
the function SetParameterBool() :
    public void SetParameterBool(string parameter,bool value)
{
view.RPC("AnimBool", PhotonTargets.AllBuffered, parameter, value);
}
the function RPC :smile:

[PunRPC]
private void AnimBool(string nameAnim,bool value)
{
Debug.LogError("Anim = "+nameAnim+" / value = "+value);
anim.SetBool(nameAnim, value);
}
with the debug log i have a value = true for one character and the other one get the value = 0
false.

I tried to put set the value to true everywhere : "view.RPC("AnimBool", PhotonTargets.AllBuffered, parameter, true);" but same like this when all character see the value to true, only the local player see is one punch annimation

So i would like to know if there is any solutions to share this kind of thing via RPC call . Or i have anyway to pass through the function OnPhotonSerializeView() to share all the time the value of my bool punch ?

Regards.

Thibault Coutaz

Viewing all articles
Browse latest Browse all 8947

Trending Articles