Skip to content

NetworkRigidBody2D with "Use Rigid Body for motion" breaks rotation sync #4009

@junpls

Description

@junpls

Description

When NetworkRigidbody2D is used with "Use Rigid Body for motion" enabled, the rotation of the object does not get reflected on the client's side.

Reproduce Steps

  1. Set up a 2D multiplayer project with a ball object that has RigidBody2D + NetworkTransform + NetworkRigidBody2D (with "Use Rigid Body for motion" enabled).
  2. Add any mechanism to make the ball rotate (e.g. let it roll down a slope or apply a force on the server).

Actual Outcome

The client sees the ball's updated position, but the rotation will remain initial.

Expected Outcome

Objects with the described setup have their rotations synced correctly.

Environment

  • OS: macOS 15.7.7
  • Unity Version: 6000.4.8f1
  • Netcode Version: 2.12.0
  • Netcode Commit: d6ebf43
  • Netcode Topology: Client-Server

Additional Context

Actually, Copilot discovered this issue. I can confirm that it becomes functional again if you uncheck "Use Rigid Body for motion" or remove NetworkRigidBody2D enitrely.

Not sure if it helps, but this is what Copilot had to say:


Found the bug. It is an upstream bug in Netcode for GameObjects itself (2.11.2 and even latest 2.12), in NetworkRigidBodyBase.InternalMoveRotation2D at NetworkRigidBodyBase.cs:568-578:

private void InternalMoveRotation2D(Quaternion rotation)
{
    var quaternion = Quaternion.identity;
    var angles = quaternion.eulerAngles;
    angles.z = m_InternalRigidbody2D.rotation;   // BUG: ignores `rotation`, reads current rb rotation
    quaternion.eulerAngles = angles;
    m_InternalRigidbody2D.MoveRotation(quaternion);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    stat:awaiting-triageStatus - Awaiting triage from the Netcode team.stat:reply-neededAwaiting reply from Unity accounttype:bugBug Report

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions