Skip to content

ClientNetworkTransform in local space wrongly synchronized before first move #3349

Closed
@kevincastejon

Description

@kevincastejon

Description

When a player joins and has its player object spawned and parented into a parent NetworkObject, has its "InLocalSpace" field checked, and has not made any move yet, then it's local position is synchronized wrongly serverside. It acts as if the server do not know about that client position being local, as it counter balance the move of the parent object to keep the player at {0.0.0} world (were it should be at {0.0.0} locally into the parent). As soon as the player makes a move, the position is synchronized correctly.

This bug is present from 1.8.1 to 1.12.2, it's not present on 1.7.1- nor on 2.0.0+ versions.

Reproduce Steps

  1. Open this minimalistic reproduction project : https://github.com/kevincastejon/NetcodeIssue-ClientNetworkTransformAndLocalSpace.git
  2. Start a server, then a client instance.
  3. See how the player transform is not synchronized correctly server side.

Actual Outcome

The player transform values seems to be treated as global server side.

Expected Outcome

The player transform values should be treated as local server side.

Workarounds

  • Checking the half float precision field makes the bug disappear.
  • Setting the position or scale threshold to 0 makes the bug disappear.

Environment

  • OS: Windows11
  • Unity Version: 2022.3.15f1
  • Netcode Version: from 1.8.1 to 1.12.2

Additional Context

The reproduction project contains the ClientNetworkTransform sample script, a ConnectionManager component with serialized bool field to determine starting a server or a client, and PlayerSpawner component that spawns the clients players and parent it into the associated gameobject, it also move this object on a loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumThis issue has medium priority and may take some time to be resolvedstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions