Title: NetworkRigidbody never syncs velocity, especially problematic for Distributed Authority · Issue #2903 · Unity-Technologies/com.unity.netcode.gameobjects · GitHub
Open Graph Title: NetworkRigidbody never syncs velocity, especially problematic for Distributed Authority · Issue #2903 · Unity-Technologies/com.unity.netcode.gameobjects
X Title: NetworkRigidbody never syncs velocity, especially problematic for Distributed Authority · Issue #2903 · Unity-Technologies/com.unity.netcode.gameobjects
Description: Description I witnessed bugged behavior when a rigidbody switches ownership in distributed authority, using the Transferrable flag without RequirePermission. The symptom was such that once the object switched its authority from playerA t...
Open Graph Description: Description I witnessed bugged behavior when a rigidbody switches ownership in distributed authority, using the Transferrable flag without RequirePermission. The symptom was such that once the obje...
X Description: Description I witnessed bugged behavior when a rigidbody switches ownership in distributed authority, using the Transferrable flag without RequirePermission. The symptom was such that once the obje...
Opengraph URL: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2903
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NetworkRigidbody never syncs velocity, especially problematic for Distributed Authority","articleBody":"### Description\r\n\r\nI witnessed bugged behavior when a rigidbody switches ownership in distributed authority, using the Transferrable flag without RequirePermission.\r\n\r\nThe symptom was such that once the object switched its authority from playerA to playerB, it would change how it moves.\r\n\r\nThis is because velocities (linear and angular) are not synced at all. I've confirmed as much in NGO 2.0.0-exp2's code.\r\nAll NetworkRigidbody/NetworkRigidbodyBase does is manipulate the interpolation and kinematic state, and registers itself onto the network transform.\r\nThe network transform has no awareness of the concept of neither linear nor angular velocities. It does not add any of them to its states.\r\n\r\nBecause of that, given even small amounts of lag, two objects can have wildly different opinions of how a non-kinematic rigidbody should be moving, and because of that, ownership cannot be easily transferred over.\r\n\r\n### Reproduce Steps\r\n\r\nThough I have not used these exact steps, I have a simple project wherein I display the linear and angular velocities of a sphere being rolled by two players, the values show that despite the sphere rolling around when controlled by another player, its actual velocity values are zero'd out.[ See it here.](https://streamable.com/vtjar6)\r\n\r\n1. Create a new project using NGO 2.0.0-exp2\r\n2. Create a scene with a `NetworkManager` and a way to host & join\r\n3. Add a sphere with a `NetworkRigidbody`, `NetworkTransform`, `NetworkObject` and set it to have `Transferrable` as true.\r\n5. Add a `NetworkBehaviour` that would set the rigidbody's linear velocity to a non-zero value (such as Vector3.Forward) on authority alone, on spawn.\r\n6. Add a button to allow claiming of ownership to another player.\r\n7. Begin a pair of player instances and make them join each other\r\n8. Witness the sphere moving for both players in a direction\r\n9. Let the joined player claim ownership of the sphere\r\n10. Witness that the sphere has stopped moving, because it has no linear velocity on its new owner.\r\n\r\n### Actual Outcome\r\n\r\nVelocities are misaligned across clients, causing mismatch on ownership transfer.\r\n\r\n### Expected Outcome\r\n\r\nVelocities are aligned and similar (identical) across all clients, allowing easy ownership transfer.\r\n\r\n### Screenshots\r\n[See the sample here](https://streamable.com/vtjar6), where\r\n1. The objects are colored based on their owner's client Id\r\n2. The top view shows editor gizmo overlays of linear velocity (top row), and angular velocity (bottom row), of the sphere.\r\n\r\nThe editor client represents the red player, Witness that while the sphere is blue, it has no/almost no linear velocity, despite moving.\r\n\r\n### Environment\r\n\r\n- OS: Windows 10\r\n- Unity Version: 6000.0.0b13\r\n- Netcode Version: 2.0.0-exp2\r\n\r\n### Additional Context\r\n\r\nI don't see any easy way to solve this one without editing the `NetworkTransform` class such that its synchronized state includes linear and angular velocities. I recognize this is far from an ideal solution, though.\r\n\r\nThere is no way to append new information to `NetworkTransform` state, nor is there any way to match its update rates, or interpolations. \r\n\r\nAt best, right now I'm experimenting with making a network behavior that uses network variables to store linear and angular velocities, and on ownership change, if you became the owner, apply those. I don't think this is the best nor right solution, and it lacks the whole 'unreliable deltas' etc based details that `NetworkTransform` supports.\r\n\r\nWould love to know what's the proper way to go about solving this in the immediate, please!","author":{"url":"https://github.com/Yoraiz0r","@type":"Person","name":"Yoraiz0r"},"datePublished":"2024-04-28T13:59:10Z","url":"https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2903"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:622b1ef8-0dc5-42ab-80f7-df000c047abb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 826C:BB729:51A22D:6FAC6A:6B00735F |
| html-safe-nonce | 7cfecc24914363393a947fbc9f396b3dd776746774bc418a6858b128d150adbd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjZDOkJCNzI5OjUxQTIyRDo2RkFDNkE6NkIwMDczNUYiLCJ2aXNpdG9yX2lkIjoiNDk1NTQ2NjY0MDA5MjMyODc5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9aa76703c57774cfdbe977a46608522a4ee72f2222a83b399b6d5c67508d2ae9 |
| hovercard-subject-tag | issue:2267580802 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Unity-Technologies/com.unity.netcode.gameobjects/2903/issue_layout |
| twitter:image | https://opengraph.githubassets.com/40b938c86ec16c7d62e5e6bc2b3e59e84e2763ff6806cb46faa9a5315b16e81b/Unity-Technologies/com.unity.netcode.gameobjects/issues/2903 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/40b938c86ec16c7d62e5e6bc2b3e59e84e2763ff6806cb46faa9a5315b16e81b/Unity-Technologies/com.unity.netcode.gameobjects/issues/2903 |
| og:image:alt | Description I witnessed bugged behavior when a rigidbody switches ownership in distributed authority, using the Transferrable flag without RequirePermission. The symptom was such that once the obje... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Yoraiz0r |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| turbo-cache-control | no-preview |
| go-import | github.com/Unity-Technologies/com.unity.netcode.gameobjects git https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git |
| octolytics-dimension-user_id | 426196 |
| octolytics-dimension-user_login | Unity-Technologies |
| octolytics-dimension-repository_id | 116385203 |
| octolytics-dimension-repository_nwo | Unity-Technologies/com.unity.netcode.gameobjects |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 116385203 |
| octolytics-dimension-repository_network_root_nwo | Unity-Technologies/com.unity.netcode.gameobjects |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width