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 Aithoneku · Dec 17, 2013 at 08:26 AM · animationnetworkingmultiplayersynchronizationroot motion

Animation with root motion synchronization in multiplayer

Short version: How can be animations with root motion synchronized in multiplayer (or networking in general) so the animations are fluent and synchronized as much as possible?

Long version: Movement of characters in my project is controlled by root motion of animation, so my code calculate speed and angular speed from user input: user clicks on scene, NavMeshAgent calculates path and result is used to navigate the character. Each player has it's own character and I want to synchronize their movement using networking.

  • It's not authoritative server networking: each client is responsible for moving their character.

  • When a character receives new destination from user, first few corners from the path are sent to other players - when first destination is reached, next corner is sent, so all players keeps track of character's path.

  • Each client calculates movement of the character from the path and animate it accordingly.

  • When the character is too long away from expected position (expected = on it's "home" client), it's moved there and rotated accordingly.

But this is not working well:

  • According question 589291 animations are calculated in Update() and not FixedUpdate() (and then interpolated) which causes following:

  • When fps on clients is different, character makes different stepd and turnd on corners which makes animation different and their movement too. It's all out of sync.

  • In other words, unlike physics, animation movement (root motion) is apparently not predictable.

So my question is: is there a way to prevent this, or root motion is unusable for multiplayer (making it singleplayer-only feature)?

Notes:

  • From my description it should be clear I use movement prediction. Reason is simple: when I "just" synchronized animation and position, it was everything but fluent, especially in corners where speed and angular speed is changed in much bigger rate then 15 updates per seconds which is default update rate for networking. Of course I could change the rate, but I need to think about bad quality connection (which is not my whim, but I cannot write more).

  • Everything is tested on single PC so the problem is not from bad connection.

  • For now I'm using animation and models from Stealth project. This is for testing only, of course.

Comment
Add comment · Show 1
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
avatar image AxelMGarcia · Dec 01, 2014 at 04:33 PM 0
Share

Did you get any insight on this? I am facing a similar problem.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Aithoneku · Dec 02, 2014 at 07:45 AM

@AxelMGarcia I was "just" learning Unity that time, so I let it go after some time and never had to solve this in my job later. However I have two ways I would go if I would need to solve this problem again in future. One solution is to just give up, move the objects in fixed update and then animate according the movement, i.e. give up animation-controlled movement. This is the safe way. The another is to set "Update Mode" to "Animate Physics" in Animator component - this 'solution' needs investigation whether it actually works or not. According execution order ( http://docs.unity3d.com/Manual/ExecutionOrder.html ) it should NOT work. Animator component documentation does not specify this (in fact, it's apparently outdated), however script documentation ( http://docs.unity3d.com/ScriptReference/AnimatorUpdateMode.html ) says that it actually DOES update during fixed update instead of standard way. Please, let me know if you try it.

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

18 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

Related Questions

Mecanim Root Motion + Networking 2 Answers

Unity networking tutorial? 6 Answers

Unity Photon: animation syncing 1 Answer

How do you sync animations in Photon? 0 Answers

Network rotation is laggy and slow 2 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