Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted How to sync head bone with Mirror Networking

Discussion in 'Multiplayer' started by xyrant, Jan 18, 2021.

  1. xyrant

    xyrant

    Joined:
    Jan 13, 2021
    Posts:
    2
    I am new to Multiplayer and I have a question. So far i've made a very simple script that moves my playermodels headbone with transform.LookAt(). I put an empty gameobject on my main camera and then made it so whenever I move up and down on the Y axis with my mouse, so does my headbone. I then put this script on my objects headbone and placed the cameras empty gameobject into it. The code works just as I intended with one player but when I try and test it out with my friend, he cannot see the head movement. I'd also like to point out that the players movement and mouse rotation already works serverside aswell as a couple of animations (on my Prefabs root I have the NetworkTransform, Identity and Animator(It's also set to Client Authority)). I watched some youtube tutorials regarding it and I wanted to reverse engineer it so it could work for headmovement aswell but nothing has worked so far. I've also watched some videos regarding the Mirror Networking and how it works but I still can't wrap my head around it because i'm fairly new to it.

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using Mirror;
    6.  
    7. public class HeadLook : NetworkBehaviour
    8. {
    9.  
    10.     public Transform head;
    11.  
    12.     void Update()
    13.     {
    14.        
    15.         if(!isLocalPlayer) {
    16.  
    17.             transform.LookAt(head);
    18.  
    19.         }
    20.  
    21.  
    22.     }
    23. }
    24.  
     
  2. xyrant

    xyrant

    Joined:
    Jan 13, 2021
    Posts:
    2
  3. CBuckington

    CBuckington

    Joined:
    Sep 28, 2020
    Posts:
    1
    bump again :'D I really need to know this
     
  4. DriesVrBase

    DriesVrBase

    Joined:
    Mar 24, 2020
    Posts:
    35
    have you tried attaching an networktransform child to the parent and then adding the bone to the transform slot?
     
unityunity