#Rotation not syncing

1 messages · Page 1 of 1 (latest)

gentle wolf
#

Unity 6000.2.6f2, latest NGO

This seemed like a trivial use-case for me but I’m having trouble getting the ship rotation to synchronize correctly (position syncs fine).

Here is the hierarchy of my Spacewar Player prefab:
NetworkObject
RigidBody2D (Interpolate enabled)
ClientNetworkTransform : NetworkTransform

Sync position x & y
Sync Rotation Z
Authority Mode = Owner
Position Threshold 0.0001
Interpolate enabled
Use Half Float Precision
NetworkRigidBody2D (Use Rigid Body for Motion, Auto Update Kinematic State, Auth Set Kinematic on Despawn)
I am using physics movement (AddForce, MoveRotation).
Rotation doesn’t sync on non-owner client at all but the x & y position does slightly change when I rotate the owner. The position seems to orbit the pivot point.

I have spent 2 days trying to diagnose and fix this to no avail. AI suggests that I punt and use a network variable to manually sync the rotation but that seems ludicrous to me for what should be an out-of-the-box expected behavior.

solar crane
#

post your code here. if its moving at all then its likely not a sync issue. Something might be fighting with your physics

gentle wolf
#

I've tried several variations of settings. The rotation works fine for the owning player but not for the remote player.

solar crane
#

I'm not seeing anything immediately wrong here. You want to check that nothing else is trying to move the network object. It should only be getting updates from the Network Transform

gentle wolf
solar crane
#

The player is also a fighter? also the network rigidbody there is disabled

gentle wolf
#

I was advised to try to disable the NetworkRigidbody2D to try to fix this problem. Unfortunately, it didn't help.

solar crane
#

That seems way overcomplicated for a SpaceWars

gentle wolf
#

The underlying framework is a reusable template for any kind of multiplayer game and includes a fully fleshed out authentication and lobby system.
The sample game is a turn-based “Othello/Reversi” clone.
This will serve as the basis for a tutorial series using the framework/template to develop multiplayer games of any type.

The “Spacewar” game only has a space background and 2 players which are simple 2D sprites that use physics for movement and simple 2D rotation. So far, there’s nothing complicated about it. The rotation simply isn’t synchronized.

solar crane
#

Just as a sanity check, spawn a simple sprite with network transform and see if the rotation syncs. nothing complex just move it around in the editor

gentle wolf
gentle wolf
#

Good news. Starting simple with just a sprite, a network transform and network player script that just rotates worked. I added a rigidbody2d and added thrust and that is also working. This definitely points to something wrong with my SpaceWar Player and/or Fighter component(s).

gentle wolf
#

It turns out it's the NetworkRigidBody2D. If I remove that, it works fine.

solar crane
#

Huh, were you not rotating using physics? That sounds like a bug either way

gentle wolf
#

No, not rotating using physics. I've done that in the past and player's generally don't like it because it's not "snappy" enough. They like instant response to want the ship to stop rotating when they take their finger off the control 🙂
Using torque the rotation would "ramp up" and then taper off (depending on how much angular drag)