Search Unity

Resolved Animation Rigging over the network

Discussion in 'Netcode for GameObjects' started by XeLLLeR, Jun 13, 2022.

  1. XeLLLeR

    XeLLLeR

    Joined:
    Dec 5, 2020
    Posts:
    30
    So question is very simple, how to sync animation rigging over the network? I know that I must set animator triggers with rpc calls, but I can't handle animation rigging that way or I don't know something. Any suggestions?
     
  2. kiranmaya

    kiranmaya

    Joined:
    May 27, 2010
    Posts:
    218
    hi, did you find any solution?
     
  3. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Hi @XeLLLeR , what do you mean by sync animation rigging ? Are you already using the ClientNetworkAnimator script?

    Code (CSharp):
    1. using Unity.Netcode.Components;
    2. public class ClientNetworkAnimator : NetworkAnimator
    3. {    
    4.      protected override bool OnIsServerAuthoritative()    
    5.      {        
    6.            return false; //allows the client to send animations data over the network    
    7.      }
    8. }
     
    codeBatt likes this.
  4. nullmoongames

    nullmoongames

    Joined:
    Dec 23, 2019
    Posts:
    10
    You probably need to rebuild the Rig for all clients. I will try this solution and post the result here
     
  5. liambilly

    liambilly

    Joined:
    May 13, 2022
    Posts:
    154
    i have the code
    rigbuilder.Build();
    the rigged anims still dont synch,
    i also have client networktransform components on the constrained and source objecs,still doesnt work
    anyone found a solution for this yet,
     
    Last edited: Feb 15, 2023
  6. liambilly

    liambilly

    Joined:
    May 13, 2022
    Posts:
    154
    i found a solution, from an idea i got from code monkey, apart from attaching networktransform to the ik targets also you need to change the rig layer weights with a networkvariable
     
  7. Traiforce

    Traiforce

    Joined:
    Feb 6, 2017
    Posts:
    3
    i still have some problems setting it up you around for a quick chat im lose to fixing it i just think im missing somthing
     
    Last edited: Mar 28, 2023
  8. codeBatt

    codeBatt

    Joined:
    Feb 12, 2020
    Posts:
    40
    I still have the same issues. What should I do in the following video my character animations does not sync. I do animations on two animators, one of them is a rigcontroller and used animation rigging. Both of the objects have clientAnimatorTransform component. Should I add networkObject for all the bones?
    @RikuTheFuffs-U
     
  9. liambilly

    liambilly

    Joined:
    May 13, 2022
    Posts:
    154
    subscribe to your networkvariable onvaluechanged, when u need to change the weights change its value instead then update the rig weights in the onvaluechanged delegate
     
    codeBatt likes this.
  10. liambilly

    liambilly

    Joined:
    May 13, 2022
    Posts:
    154

    if you still experience this issue watch this video on how to solve the problem
     
    The_ZayNepz_Guy and codeBatt like this.
  11. Davidaval8r

    Davidaval8r

    Joined:
    Apr 8, 2016
    Posts:
    3
    My solution: Only apply a client network transform to the source object. For me, it was the cinemachine virtual camera for example. Then, dont disable the camera for other players, but just set priority to 0 so you dont get their camera rendered but its still active so it can rotate.
    upload_2023-12-13_1-54-45.png upload_2023-12-13_1-56-40.png upload_2023-12-13_1-58-13.png
     

    Attached Files:

  12. liambilly

    liambilly

    Joined:
    May 13, 2022
    Posts:
    154
    you don need a network object n client network transform on the camera, just set it to player when the player spawns