UNET: Network Transform with skeleton?

Hi guys,

I’m working on a multiplayer application involving the Kinect. Everything works; however, I need to send the entire skeleton’s transforms to the server for syncing across clients. Currently, it would appear that NetworkTransform only sends the transform of the object it is attached to (not child objects).

Is it possible to have the NetworkTransform be applied recursively?

http://forum.unity3d.com/threads/synchronizing-an-entire-skeleton.355636/

Well having had at it - the best I’ve been able to come up with is to do it manually using [SyncVar] for position and rotation of each joint.

Bearing in mind the limitation of 31 sync vars, it probably isn’t ideal though it works for my case.

For future reference, see this video for details of the sync var implementation: UNET Part 1 - Setup and Movement Syncing - YouTube

[SyncVar] Vector3 HipsPos; // HIPS JOINT
[SyncVar] Quaternion HipsRot;
[SerializeField] Transform Hips;
....

void Update()
{
	if (isLocalPlayer)
		TransmitPos (); // telling others where this is for them to lerp their client-side obj to
	else
		LerpTransformPositions(); // lerping this non-local player to the position that the real player transmitted

}

void LerpTransformPositions()
{
	float rate = Time.deltaTime * lerpRate;
		
	Hips.position = Vector3.Lerp(Hips.position, HipsPos, rate);
	Hips.rotation = Quaternion.Slerp (Hips.rotation, HipsRot, rate);
    ....
}

[Command]
void Cmd_SendPosToServer()
{
    HipsPos = Hips.position;
    HipsRot = Hips.rotation;
    ....
}

[ClientCallback]
void TransmitPos()
{
    Cmd_SendPosToServer ();
}

I’ve been struggling with the same problem and found the NetworkTransformChild script.

I got my skeleton working by adding a NetworkTransformChild component for each joint to the root of the skeleton. It’s still a hell of a manual job, and the root object gets littered with 30-something scripts, but it seems to work.