Skip to content

fix: NetworkRigidbody authority and ownership detection #1891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Apr 20, 2022

This is a minor refactor of NetworkRigidbody and NetworkTranaform to elminate constant FixedUpdate polling in NetworkRigidBody to detect changes in ownership.
This also fixes an issue where both authoritative and non-authoritative Rigidbodies were not kinematic until spawned, now all instances are set to kinematic until authority is determined and applied (this happens during OnNetworkSpawn and OnGainedOwnership/OnLostOwnership).

MTT-3374

Testing and Documentation

  • No tests have been added.

MTT-3374
Initial changes for this fix.
Migrating the authority mode check to NetworkTransform since this is what dictates authority anyways.
@NoelStephensUnity NoelStephensUnity marked this pull request as draft April 20, 2022 16:10
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review April 20, 2022 16:24
updated and added comments
@ShadauxCat
Copy link
Collaborator

Would really like to see some tests on this so we don't have regressions of this behavior later.

Adding ownership tests
Realized we could further simplify NetworkRigidbody and added additional testing against owners not being Kinematic and non-owners being kinematic.
Also had to have the NetworkManager relative test prefab instances ignore each others' colliders so they wouldn't skew the position testing.
whitespace fixes
parameter name change
better clarity in a comment
This fixes an issue with not being able to find ClientNetworkTransform and makes the IsServerAuhtoritative internal.
@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) April 20, 2022 20:16
realized we don't need to save the original Kinematic state.
updated a comment
needed to add COM_UNITY_MODULES_PHYSICS define in runtime and exclude the test if the physics module is not included.
removing 2 CR/LF
didn't need all of the changes made to the asmdef file
removing xml doc API reference
NoelStephensUnity and others added 5 commits April 20, 2022 17:46
…runtimetests.asmdef

Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
Had to adjust the rigid body interpolation setting to be based on authority and not NetworkTransform.Interpolate (bug from this PR)
Had to re-adjust the original rigid body test to match the NetworkRigidbody change where when it is despawned physics is not applied.
Fixing edge case scenario with object parenting test.
Copy link
Contributor

@TwoTenPvP TwoTenPvP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏻

@NoelStephensUnity NoelStephensUnity merged commit 2151772 into develop Apr 21, 2022
@NoelStephensUnity NoelStephensUnity deleted the fix/mtt-3374-networkrigidbody-ownership-change-detection branch April 21, 2022 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants