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
- Set up a 2D multiplayer project with a ball object that has
RigidBody2D + NetworkTransform + NetworkRigidBody2D (with "Use Rigid Body for motion" enabled).
- 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);
}
Description
When
NetworkRigidbody2Dis used with "Use Rigid Body for motion" enabled, the rotation of the object does not get reflected on the client's side.Reproduce Steps
RigidBody2D+NetworkTransform+NetworkRigidBody2D(with "Use Rigid Body for motion" enabled).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
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
NetworkRigidBody2Denitrely.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: