Shared Player and motion Controller positions

I'm attempting to created a shared scene where i can see other peoples position & rotation Along with controller position and rotation.

I have a player prefab with a head and two hands. I should see the remote players head and controllers as they move around.

I want to see my hands prefab over the top of my own controllers too.

The player prefab follows the mixed reality camera parent correctly.
Any ides what I'm doing wrong here?

 [SyncVar]
    private Vector3 localPosition;
    [SyncVar]
    private Quaternion localRotation;
    [SyncVar]
    private Vector3 remoteRightControllerPostion;
    [SyncVar]
    private Vector3 remoteLeftControllerPostion;
    [SyncVar]
    private Quaternion remoteRightControllerRotation;
    [SyncVar]
    private Quaternion remoteLeftControllerRotation;



    // Update is called once per frame
    void Update()
    {

        if (!isLocalPlayer)
        {
            rightHand.transform.localRotation = remoteRightControllerRotation;
            leftHand.transform.localRotation = remoteLeftControllerRotation;
            rightHand.transform.localPosition = remoteRightControllerPostion;
            leftHand.transform.localPosition = remoteLeftControllerPostion;
            return;
        }

        remoteLeftControllerRotation = UnityEngine.XR.InputTracking.GetLocalRotation(UnityEngine.XR.XRNode.LeftHand);
        remoteRightControllerRotation = UnityEngine.XR.InputTracking.GetLocalRotation(UnityEngine.XR.XRNode.RightHand);

        remoteRightControllerPostion = transform.TransformPoint(UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.RightHand));
        remoteLeftControllerPostion = transform.TransformPoint(UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.LeftHand));

        rightHand.transform.rotation = remoteRightControllerRotation;
        leftHand.transform.rotation = remoteLeftControllerRotation;
        rightHand.transform.position = remoteRightControllerPostion;
        leftHand.transform.position = remoteLeftControllerPostion;

        head.transform.rotation = CameraCache.Main.transform.rotation;
        transform.position = CameraCache.Main.transform.position;
        CmdTransform(CameraCache.Main.transform.position, CameraCache.Main.transform.rotation,  leftHand.transform.rotation, rightHand.transform.rotation, rightHand.transform.localPosition, leftHand.transform.localPosition);
    }


    /// Sets the localPosition and localRotation on clients.
    /// </summary>
    /// <param name="postion">the localPosition to set</param>
    /// <param name="rotation">the localRotation to set</param>
    [Command(channel = 1)]
    public void CmdTransform(Vector3 postion, Quaternion rotation, Quaternion rightHandRotation, Quaternion leftHandRotation, Vector3 rightControllerPostion, Vector3 leftControllerPostion)
    {

        localPosition = postion;
        localRotation = rotation;
        remoteRightControllerRotation = rightHandRotation;
        remoteLeftControllerRotation = leftHandRotation;
        remoteLeftControllerPostion = leftControllerPostion;
        remoteRightControllerPostion = rightControllerPostion;
    }![](https://us.v-cdn.net/6026774/uploads/editor/xo/xjmtiu29euyi.png "")

Sign In or Register to comment.