Skip to content

fix: Auto configure rigidbody based on physics mode selection - #4229

Merged
EmandM merged 9 commits into
develop-3.x.xfrom
fix/auto-configure-for-physics-mode
Oct 29, 2026
Merged

EmandM merged 9 commits into
develop-3.x.xfrom
fix/auto-configure-for-physics-mode

Conversation

@NoelStephensUnity

@NoelStephensUnity NoelStephensUnity commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Purpose of this PR

Prevents the visual issues NGO users currently see with Rigidbodies in hybrid sessions, under either N4E NetcodeConfig physics mode, by applying two temporary workarounds automatically.

Always Run: Non-hybrid NGO prefabs that use a NetworkRigidbody jitter or ghost, because the Rigidbody's own interpolation no longer lines up with when physics steps. When a session has hybrid prefabs, these instances now use Extrapolate on the transform authority and None on every other peer. The setting follows authority across ownership changes and kinematic updates, and the authored value is restored on despawn.

User Controlled: On the host, full tick smoothing holds hybrid prefabs with a NetworkRigidbody in place, so they don't move. Full tick smoothing is now disabled on those prefabs when they are registered, and a developer-level log says so.

Both are temporary. The User Controlled workaround will be removed once unity/unity#135166 ships in the next N4E update.

PR Scope:

  • NetworkRigidbodyBase: the Always Run interpolation override for non-hybrid 3D Rigidbodies, applied only when the session has hybrid prefabs (N4E defaults to Always Run, so plain NGO sessions must not be affected).
  • NetworkPrefab.Validate: the User Controlled full tick smoothing change for hybrid prefabs with a NetworkRigidbody.
  • ghostobjects.md: documents both behaviors.

Out of scope:

  • 2D Rigidbodies (N4E does not support Rigidbody2D yet).
  • In-scene placed hybrid objects (not supported yet).
  • Tests (the workarounds are temporary and will be adjusted after release).

Jira ticket

NA

Changelog

NA

Documentation

  • Includes documentation updates: a "Mixed mode objects and physics" section in ghostobjects.md.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done: in NGO examples under both physics modes, including an owner-authoritative non-hybrid prefab with a Rigidbody.

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Up-port

No up-port

Backports

No back-port

Fixing issue with rigidbody and physics mode.
Adding minor blurb about the rigidbody adjustments
@NoelStephensUnity
NoelStephensUnity marked this pull request as ready for review October 28, 2026 17:13
@NoelStephensUnity
NoelStephensUnity requested review from a team and jabbacakes as code owners October 28, 2026 17:13

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Harness Review

Needs changes

The change adds automatic physics configuration, but its interaction with initialization and later lifecycle callbacks needs attention.

Reviewed commit 5985d07

🤖 Helpful? 👍/👎

Adding whitespace
…across authority changes

- AlwaysRun interpolation override now applies only when the session has hybrid prefabs (N4E defaults to AlwaysRun, so plain NGO sessions were affected), only to 3D Rigidbodies, and is reapplied on every kinematic/ownership update instead of being reset to the authored value.
- Restores the authored kinematic capture for hybrid prefabs to Awake only, so OnDestroy no longer restores the runtime kinematic state.
- Guards both NetcodeConfig.Global reads against a missing config, and compiles the full tick smoothing change only when a physics module is present.
@EmandM
EmandM enabled auto-merge (squash) October 28, 2026 20:16
@codecov-github-com

codecov-github-com Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 36.36364% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...objects/Runtime/Components/NetworkRigidBodyBase.cs 37.50% 10 Missing ⚠️
...gameobjects/Runtime/Configuration/NetworkPrefab.cs 33.33% 4 Missing ⚠️
@@                Coverage Diff                @@
##           develop-3.x.x    #4229      +/-   ##
=================================================
- Coverage          76.20%   76.16%   -0.04%     
=================================================
  Files                159      159              
  Lines              27576    27598      +22     
=================================================
+ Hits               21013    21021       +8     
- Misses              6563     6577      +14     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 75.25% <36.36%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...gameobjects/Runtime/Configuration/NetworkPrefab.cs 62.01% <33.33%> (-1.40%) ⬇️
...objects/Runtime/Components/NetworkRigidBodyBase.cs 62.19% <37.50%> (-0.76%) ⬇️
Components Coverage Δ
com.unity.netcode.gameobjects 76.16% <36.36%> (-0.04%) ⬇️

ℹ️ Need help interpreting these results?

NoelStephensUnity and others added 4 commits October 28, 2026 16:20
Uses the cached authority that UpdateOwnershipAuthority refreshes on spawn and on every ownership change, so an owner-authoritative body extrapolates on its owner and stops on the server.

## Mixed mode objects and physics

To avoid visual anomalies, NGO automatically adjusts some Rigidbody settings based on the **Physics Run Mode** of the `NetcodeConfig` asset:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
To avoid visual anomalies, NGO automatically adjusts some Rigidbody settings based on the **Physics Run Mode** of the `NetcodeConfig` asset:
To avoid visual anomalies, Netcode for GameObjects automatically adjusts some Rigidbody settings based on the **Physics Run Mode** of the `NetcodeConfig` asset:

Comment on lines +93 to +94
- **Always Run**: In a session that has hybrid prefabs, non-hybrid NGO prefabs with a NetworkRigidbody and a 3D Rigidbody have the Rigidbody's **Interpolate** value set to **Extrapolate** on the authority instance and to **None** on all non-authority instances. The authority instance is the server or host for a server-authoritative NetworkTransform, or the owner for an owner-authoritative one. The value follows authority when ownership changes, and the original value is restored when the instance despawns.
- **User Controlled**: Hybrid NGO prefabs with a NetworkRigidbody have **Full Tick Smoothing** set to **Disabled**.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- **Always Run**: In a session that has hybrid prefabs, non-hybrid NGO prefabs with a NetworkRigidbody and a 3D Rigidbody have the Rigidbody's **Interpolate** value set to **Extrapolate** on the authority instance and to **None** on all non-authority instances. The authority instance is the server or host for a server-authoritative NetworkTransform, or the owner for an owner-authoritative one. The value follows authority when ownership changes, and the original value is restored when the instance despawns.
- **User Controlled**: Hybrid NGO prefabs with a NetworkRigidbody have **Full Tick Smoothing** set to **Disabled**.
- **Always Run**: In a session that has hybrid prefabs, non-hybrid Netcode for GameObjects prefabs with a NetworkRigidbody and a 3D Rigidbody have the Rigidbody's **Interpolate** value set to **Extrapolate** on the authority instance and to **None** on all non-authority instances. The authority instance is the server or host for a server-authoritative NetworkTransform, or the owner for an owner-authoritative one. The value follows authority when ownership changes, and the original value is restored when the instance despawns.
- **User Controlled**: Hybrid Netcode for GameObjects prefabs with a NetworkRigidbody have **Full Tick Smoothing** set to **Disabled**.

@EmandM
EmandM merged commit ee8c8ee into develop-3.x.x Oct 29, 2026
27 checks passed
@EmandM
EmandM deleted the fix/auto-configure-for-physics-mode branch October 29, 2026 12:01
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.

4 participants