Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by cjhambo0720 · Nov 22, 2021 at 11:40 PM · networkingtransformmirrorbuffer

Unity/Mirror Network Delay After Transferring Client Authority

This is a complicated issue so I attached a gif to show what's going on

alt text

Order of events:

  1. Player B (on the right) is controlling the human and has client authority

  2. Player A (on the left) hits the human with a bookshelf

  3. Player B is removed from the human, turns back into a pink ball, and has client authority of the human removed

  4. Player A is assigned client authority for the human

  5. As player A moves away, locally the human model moves in sync with player A (ignore that the pink balls are not rendering while controlling the human, this is a feature)

  6. From Player B's view, the human model slowly approaches the pink ball (Player B) while the Client Buffer and Client Catchup max out.

  7. Finally, the human traces out the path of Player A until it finally catches up and remains in sync afterwards.

Some notes:

  • The first couple times the authority is switched, it does not produce the error

  • The effect becomes longer after each authority transfer and will eventually crash Unity

  • The 'hasAuthority' boolean for the Human prefab seems to be turning on and off correctly

[Network Transform for Human Prefab] alt text

Player A calls the CmdControlPlayer function, 'other' is the human currently controlled by Player B:

 [Command]
     public void CmdControlPlayer(GameObject other)
     {      
         //Unrelated code
 
         AssignAuthority(other);
 
         //Unrelated code
     }
 
     void AssignAuthority(GameObject other)
     {
         RemoveClientAuthority(other);
 
         other.GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
     }
 
     void RemoveClientAuthority(GameObject other)
     {
         if(other.GetComponent<NetworkTransform>().connectionToClient != null)
         {
             other.GetComponent<NetworkIdentity>().RemoveClientAuthority();
         }
     }

The input is being translated to movement as follows:

 private Vector3 bodyMovement;
 public GameObject possessedObject;
 [SerializeField] private Rigidbody controllableBody;

 //Called in Update function
 void PlayerInput()
 {
     float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity;
       
     input_X = Input.GetAxisRaw("Horizontal");
     input_Z = Input.GetAxisRaw("Vertical");

     // If the player is controlling the human
     if(isHuman)
     {
         bodyMovement = (controlledObject.transform.right * input_X) + (controlledObject.transform.forward * input_Z);
         controlledObject.transform.Rotate(Vector3.up * mouseX);        
     }
     else
     {
         //Control pink ball
     }
 }
  
 void FixedUpdate()
 {
     if(hasAuthority)
     {
         if(controlledObject != null)
         {
             transform.position = controlledObject.transform.position;

             if(isHuman)
             {
                 transform.rotation = controlledObject.transform.rotation;

                 // RigidBody Movement For Human //
                 controllableBody.velocity = ((bodyMovement.normalized * moveSpeed) + (transform.up * controllableBody.velocity.y));
                 Camera.main.transform.localRotation = Quaternion.Euler(yRotation, 0f, 0f);                  
             }
         }
     }
 }

My guess is that this has something to do with the buffer filling up with something but not being able to catch up for a short time. Any help would be welcome!

Using Unity 2020.3.20f1 Personal on Windows 10

ezgifcom-gif-maker-3.gif (495.2 kB)
1.png (34.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cjhambo0720 · Dec 01, 2021 at 05:08 AM

Anyone have any idea about this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

250 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

MIRROR: Connect Android client to PC server? 2 Answers

Mirror: Can't connect to Oculus Quest 2 (Android) Host - Instant Disconnect 1 Answer

How do I update values and the transform of an object on the server's and client's side? 0 Answers

Update transform component from server every frame 1 Answer

Mirror doesn't show LAN options 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges