Following Lag Compensation article - Sync issues - odd rotation

(SOLVED) - not exactly sure WHY this works, although i assume it works because it stops any trivial remaining turning velocity from being accounted for, but it seems that *Freeze Rotation* in the inspector prevents this oddity

Hey again guys. Just been hammerin' away at my thing here, and i have come across another issue i cant seem to resolve yet, as atm, i'm not even sure where to begin looking.

I followed along in the Lag Compensation article, and i am now using only a photon view with IPunObservable.

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { stream.SendNext(this.rbody.position); stream.SendNext(this.rbody.rotation); stream.SendNext(this.rbody.velocity); } else { networkPosition = (Vector3)stream.ReceiveNext(); networkRotation = (Quaternion)stream.ReceiveNext(); rbody.velocity = (Vector3)stream.ReceiveNext(); float lag = Mathf.Abs((float)(PhotonNetwork.Time - info.SentServerTime)); networkPosition += (this.rbody.velocity * lag); } }

and ofc, in the fixed update...

private void FixedUpdate() { if (PhotonNetwork.IsConnected && !_photonView.IsMine) { rbody.position = Vector3.MoveTowards(rbody.position, networkPosition, Time.fixedDeltaTime); rbody.rotation = Quaternion.RotateTowards(rbody.rotation, networkRotation, Time.fixedDeltaTime * 100.0f); return; }

Now, for the most part, everything is good, but when a hero starts firing their bow, both players can see the arrows travelling in the correct direction, but local players see the other players as they are shooting (locally - standing in place no turning), slowly rotating in circles as they continually shoot. Even after they stop shooting... in the editor, i can literally see their avatar y rotation to keep changing , even after no input , all values are zero as far as motion / rotation input , yet the local client is receiving rotation changes . The only syncd properties at this time are now the animation itself. i feel too noobish sometimes. :(

PS : I didn't realise the code inserts looked so damn ugly... next time i will skip the code blocks.

Comments

  • I have posted a video in my gdrive just to hi-lite what i mean, as i'm sure half the time i make no sense. The vid shows it exactly happening.

    https://drive.google.com/open?id=1kPF5jf1E0M9340R194XobVdgKbOnfYpB
  • Will_CWill_C
    edited May 17
    (SOLVED) OP Issue - not exactly sure WHY this works, although i assume it works because it stops any trivial remaining turning velocity from being accounted for, but it seems that *Freeze Rotation* in the inspector prevents this oddity.

    (SOLVED) this ISSUE :
    Seems i had a few colliders sitting around on projectiles i shouldn't have. Mwuahaha. Case closed.



    [JUNK DON'T READ : SOLVED]
    But, it gets stranger now...


    The animations are flawless and smooth on their own, no jerkiness, exact looped poses, and on the local client look and act exactly as they should, But...

    It seems, that on all other viewing clients, the characters, on each ShootProjectile() method (all animation driven), does a quick jerky movement along the x axis. Strangely, one can not freeze position of the rigidbody in the inspector, as you can with rotations. The rotations still seem to be changeable and operational through script, but the positions are not. They simply stop functioning all together.

    I'll see what i can come up with, but another head scratcher for sure. :open_mouth:
    [/JUNK DON'T READ SOLVED]
Sign In or Register to comment.