Setting transform position not working in my vr network

Hi,
Iam trying to set up a simple multiplayer in vr. For this i have made a scene with a vr controller and a Network Manager, spawning an avatar for each client. I am doing this so the actual VR rig dosnt have to get sent through the network but rather just an Avatar representation. I am setting the avatar to the position of the rig localy and then I only send the position of each avatar bound to the rig to each client.
For some reason the avatars spawn for each client but the movement only works for the host. For all other clients the avatars neither move in local space nor on the network. Does anyone know why this could be the case?


FollowTarget Script:

public class FollowTarget : NetworkBehaviour
{
    public Transform target;
    public Vector3 offset = new Vector3(0f, 0f, 0f);
    [SerializeField] private bool _isNetworkAvatar;
    [SerializeField] private bool _keepYPosition;
    [SerializeField] private string TagToFollow = "MainCamera";

    private void Start()
    {
        if (_isNetworkAvatar)
        {
            target = GameObject.FindGameObjectWithTag("MainCamera").transform;
            Debug.Log($"Initializing Network Avatar for: {target.gameObject.name}");
        }
    }

    private void Update()
    {
        
        if(!IsOwner) return;

        //Debug.Log($"My Position:{transform.position} should be {target.position}");

        switch (_keepYPosition)
        {
            case true:
                transform.position = new Vector3(target.position.x, transform.position.y, target.position.z) +
                                     offset;
                Debug.Log(new Vector3(target.position.x, transform.position.y, target.position.z) +
                          offset);
                break;
            case false:
                transform.position = target.position + offset;
                break;
        }
    }
}

Avatar Prefab:

Ok, so after many tries I found the solution. The problem was that the client was’nt authorized to change its own position in the network, so i had to add an extra override to the NetworkTransform script which gives the client authorization.

protected override bool OnIsServerAuthoritative()
{
    return false;
}

that fixed it. :slight_smile: