Photon and animation rigging
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Photon and animation rigging
Atix
2020-11-07 14:04:18
Hello!
Im using Unity's animation rigging package to create head look and spine control for FPS controller which is controlled by position of the rig targets. So according to that Im moving rig targets according to players body and syncing it to all players like in this photo:
](https://hizliresim.com/WDoc4F)
Here is the code:
void LateUpdate() //animation rigging
{
if (!PV.IsMine)
return;
headAngleY += mouseY;
headAngleY = Mathf.Clamp(headAngleY, 0, 140); //Vücut sınırlama
spinePos = new Vector3(0, Mathf.Sin((headAngleY + offset) * Mathf.Deg2Rad), Mathf.Cos((headAngleY + offset) * Mathf.Deg2Rad));
spineTarget.transform.localPosition = spinePos;
headPos = new Vector3(yRotation * Mathf.Deg2Rad, Mathf.Sin(((headAngleY - 90) + offset) * Mathf.Deg2Rad), Mathf.Cos(((headAngleY - 90) + offset) * Mathf.Deg2Rad));
headTarget.transform.localPosition = headPos;
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext((Vector3)spineTarget.transform.localPosition);
stream.SendNext((Vector3)headTarget.transform.localPosition);
}
else
{
this.spineTarget.transform.localPosition = (Vector3)stream.ReceiveNext();
this.headTarget.transform.localPosition = (Vector3)stream.ReceiveNext();
}
}
But its not smooth on other players body. Its like its skiping frames. Not like normal walking & crouching animations.
https://www.youtube.com/watch?v=aDXqsIX2lEo
Any help and idea would be great! Thank alot.
Comments
Any updates about this? did you manage to fix it? I'm new with animation rigging and I'm having the same issues.
@Talane wrote: »
Any updates about this? did you manage to fix it? I'm new with animation rigging and I'm having the same issues.
Its a bit late but you have to put tranform view inside rig targets. So animation rigging will do the job on everyclient according to rig target.
Back to top