Client Network Transform syncing unchecked axis

Hi!

I have a GameObject with the following line of code:

transform.position = new Vector3(transform.position.x, transform.position.y, -5f);

The GameObject also has the ClientNetworkTransform component attached to it.

This is a 2D game so the Z axis is unchecked. When I enter play mode, the Z axis of the GameObject is at 0 even though the script is supposed to force it to be -5.

When I disable the ClientNetworkTransform component in runtime in the editor, then the Z is -5 but for some reason when its enabled, the Z is at 0.

There is no other script that messes with the position of this GameObject. Just these.

I would appreciate any help! Thanks (:

HI @yoavtc2004 ,

Could you provide a bit more context of where that line of code is being invoked (i.e. in Awake, Update, Start, OnNetworkSpawn, etc) and on which component it is being invoked? It would help me determine what might be happening here.

Hey there, I actually have the same problem right now. I’m using the NetworkTransform Component and only want to sync the x and z position, because the y-position can be calculated locally on each client to hopefully reduce some network traffic. However, when I try to modify the y-position of the object (testing in the scene view) it is instantly overwritten by the value the object spawned at and not able to be modified. When I disable the NetworkTransform Component on that Gameobject it is free to move again (Obviously on all axis then). So my conclusion it that disabling an axis stops syncing it, but it is still overwritten with the first value the object is spawned at.

Is this behaviour intented? And if so, how could I modify the position regardless (I already tried to modify it in LateUpdate or Update with a very late Script Execusion Order, neither worked without the object jumping the y-position between frames). I guess one possibility could be to wrap the object around a parent and modify the y-position of that, but that doesn’t seem clean.

@AtticGamesStudios

What version of NGO are you using?
Could you also include a screenshot of your NetworkTransform settings?

The only thing that I can think of that would be doing this is if you are using Half Float Precision (that will overwrite all axis).

I’m using NGO 2.3.2.

Those are my settings, however I tried disabling Half Float Precision, but the behaviour remains the same.

In the Network Transform Documentation I found the following:
It is important to note that when any synchronized property changes the NetworkTransform is effectively "teleported" (i.e. all values re-synchronized and interpolation is reset) which can cause a single frame delta in position, rotation, and scale (depending upon what is being synchronized).

Does that might refer to the issue? (Just as an additional information, the unchecked axis is overwritten in every frame, not just when any of the checked properties are changed from the server/authority.)

“Full State Update (or Teleport)” Documentation Update

That pertains to any changes in synchronized NetworkTransform states that requires a full state update. As an example, any changes to NetworkTransform.InLocalSpace will require that the authority instance provides a full state update to all of the cloned/non-authority instances. Of course, we have been aware that the current documentation doesn’t provide enough details about that topic.

Fortunately, PR-1443 is a large update to that area of the documentation (should be available very soon).
Until then here is a link to the updated documentation which provides you with all of the scenarios that trigger a “full state update/teleport”.

Issue Changing Non-Synchronized Axis on Non-Authority Instances

After reading the described issues, I looked over the NetworkTransform (v2.x) component and discovered that indeed it does not allow for non-authority instances to make changes to the local transform’s axis that are not being synchronized by the authority instance.

PR-3471 is the fix for this issue and will be in the next (v2.4) update.

1 Like