Here is an example script that synchronizes the bones of an entire skeleton. This is intended to be used by dynamic animation systems driven by user input, such as Kinect systems doing motion capture for shared VR/AR environments. This could be used for regular Mecanim driven animation, but the bandwidth usage is much high than the usual methods.
(This is much more efficient than using 30+ NetworkTransformChild scripts to animate all the bones)
Instructions:
Add the NetworkSkeleton component to the root prefab with the Network Identity.
drag the root of the skeleton of the object into the Target slot.
disable the Animator and animation scripts on the object
make a script to enable the Animator and animation scripts in OnStartLocalPlayer
The size of the animation data may be quite big for large skeletons. Setting the SyncLevel can reduce the size - but deep child bones wont animate. For example, the avatar in the mecanim sample project is 78 bones.
If the size of the animation data is larger than the MTU (about 1400 bytes), add a UnreliableFragmented channel to your network configuration and specify that as the NetworkChannel.
The attached custom editor class must go into the Editor directory of the Unity project.
Wow, you guys are awesome, thanks for uploading this. This is extremely helpful for me.
Now say I want most of the bones (down to some sync level) to be controlled by the host (for all clients) and some bones on a deeper hierarchy level (e.g. the hands) by the clients themselves. What would be your suggested way of going about this? It seems I can only have one NetworkIdentity on the root of the skeleton, otherwise I could just attach another one to a child (the hand) and set their âlocalPlayerAuthorityâ property accordingly. Any thoughts?
Hi Sean,
Can you provide a sample for âIf the size of the animation data is larger than the MTU (about 1400 bytes), add a UnreliableFragmented channel to your network configuration and specify that as the NetworkChannel.â
I tried following but could not get this working:
I have added one extra channel in NetworkManagerâs advanced configuration. But this chanlle #2 is not visible in NetworkBehavior if I send a Command on Channel 2.
I also tried changing the Channel#1 to Unreliable Fragmented but it gives an error message
âno free events for long messageâ.
i am using a character with animations and with bone rotations throw code in late update for ovewriting the animator, i am using network skeleton for sending bone transformation and work fine but the host, the host local player dont update in clients only the bone rotation throw code the animation works well
I know this is an old-ish post but I just came across this same need. A few things are not clear, if I start this on a client then the animation is not in sync (start as in enabling the animation controller) - if I start it on the server then it is in sync however the animation on all clients (ie., except the server+client) the animation is not interpolated. I feel like I am missing something.
Anyone else having this issue or can shed some light?