Transform View Fine Tuning Jitters

So I'm trying to use pun 2 to sync player movements across games. I have a simple scrip that travels the stage via spinning on a pivot, changing pivot position each time a button is clicked. Also have a simple move straight script.

My problem is PUN2 Transform View Jitters Way too much and the movement is anything but appealing. I fine turned it with Transform View Classic but I'm looking to see if I'm doing things right or if someone can point me in a better direction to track enemy movement. I know it'll never be precise because of its online but it just seems odd that its so jittery.

Here are some snippets


SETTINGS
--------
I have two Transform views monitoring the items. First Transform View is for the pivot, second is for the character image.
This is because the pivot switches spinning from one side to the other when a button is pressed as intended. It would be alot less work if there was a way to only focus on one specific transform for this kind of movement.








VIDEO of movement, it used to be god awful worse.
--------------------------

https://youtu.be/QuvzHIcYuxY


---------------------------
CODE
---
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MenuPlayerScript : MonoBehaviour
{

    public GameObject dottedLine;
    public Transform pivot, Character;
    public Transform[] Hand;
    public int pos;
    // for testing make private visible
    [SerializeField]
    private bool Spinning, Gliding;
    [SerializeField]
    private int rotDir = -1;
    [SerializeField]
    private float rotSpeed = 8f, moveSpeed = 10, fastSpeed =8, SlowSpeed = 3;

    public void SLOWDOWN()
    {

        rotSpeed = SlowSpeed;// slowdown rotation to initiate glide targeting
        if (pos == 0)
        {
            dottedLine.transform.localRotation = Quaternion.Euler(0, 0, 0); 
            // rotate to position pivot is facing
        }

        else
        {
            dottedLine.transform.localRotation = Quaternion.Euler(0, 180, 0);
        }

        dottedLine.SetActive(true);
    }

    public void GLIDE (){
        dottedLine.SetActive(false);
        Spinning = false;
        rotSpeed = fastSpeed;
        Gliding = true;

        }

    public void STOP_SPINNING()
    {
        Spinning = false;
        Gliding = false;
    }

    public void BUTTON_DOWN()
    {
        Gliding = false; // stop gliding
        Spinning = false;  //stop spining;
        Character.SetParent(null);
            pos++;
            if (pos == 2)
            {
                pos = 0;
            }
            pivot.position = Hand[pos].position;
            Character.SetParent(pivot);
            //NEW_AXIS();
            SWITCH_ROTATION(); //set rotation as opposite of what it was 
            Spinning = true;
    }

    public void SWITCH_ROTATION()
    {
        rotDir = rotDir * -1;
    }
    void FixedUpdate()
    {
        if (Spinning)
        {
            pivot.Rotate(Vector3.forward * (rotSpeed * rotDir));
        }

        if (Gliding)
        {
            if(pos ==1)
            {
                pivot.transform.Translate(Vector3.left * Time.fixedDeltaTime * moveSpeed);
            }
            else
            {
                pivot.transform.Translate(Vector3.right * Time.fixedDeltaTime * moveSpeed);
            }
        }
    }
}


--------

Comments

  • Try to lower Lerp speed.
  • FoggoApps
    FoggoApps
    edited January 2019

    Try to lower Lerp speed.

    The Lower leap speed worked! its at 10 across the board now thanks. The only real problem now is the pivot slides into position, which I'm guessing is because of the lerp?
  • You can use the move towards and rotate towards values in the sync component, they can help with that as well as a lower lerp value.
  • FoggoApps
    FoggoApps
    edited January 2019
    Gage_IAG said:

    You can use the move towards and rotate towards values in the sync component, they can help with that as well as a lower lerp value.

    Thanks the rotate towards suggestion made it almost perfect rotation wise! I'll just try my best to figure out the little sliding that goes on between the pivot points. One last question.

    Anyone know why my stand alone on PC connects to SA server region, while my Editor version connects to US. I'm in US michigan so idk why SA is even considered. The ping is 155 so It shouldn't even be close to the best. Again since when I run my Editor version connects on the same computer, to US with about 61 ping.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @FoggoApps,

    Thank you for choosing Photon!

    Anyone know why my stand alone on PC connects to SA server region, while my Editor version connects to US. I'm in US michigan so idk why SA is even considered. The ping is 155 so It shouldn't even be close to the best. Again since when I run my Editor version connects on the same computer, to US with about 61 ping.
    Yes this is a known issue. Read about it here. However, this is the first time we get a report of "US" and "SA" on the same machine...
  • FoggoApps
    FoggoApps
    edited January 2019
    JohnTube said:


    However, this is the first time we get a report of "US" and "SA" on the same machine...

    Yeah I thought it was weird. Just built it to make sure it was correct and here's the screenshot of the standalone and Editor running at the same time.

    
    
    
    public void CONNECT() // CONNECT TO LOBBY ONLINE
        {
            PhotonNetwork.ConnectUsingSettings();
            Debug.Log("Connecting to Server");
        }
    
        public override void OnConnectedToMaster()
        {
            PhotonNetwork.AutomaticallySyncScene = true;
            Debug.Log("Connected to Server!");
            debug.text = (PhotonNetwork.BestRegionSummaryInPreferences);
    
            PhotonRoom.room.JOIN_RAND_ROOM();
        }
    Thats the code used to connect and display the text of connected server.
  • @FoggoApps Are you using a VPN?
  • Gage_IAG said:

    @FoggoApps Are you using a VPN?

    Nah its not active. Again its on the same computer so Wouldn't that move both Addresses? Also restarted my computer and the problem arose still.
  • One problem may be that the best region is "sticky" per client. So as long as you build into the same folder / build, the region probably doesn't change anymore (and Editor and standalone got distinct player prefs).

    Add this before you call ConnectUsingSettings() to get rid of any current sticky region:
    Debug.LogWarning("Going to reset best region!");
    PhotonNetwork.BestRegionSummaryInPreferences = null;

    Set the log level to "Informational" for PUN and rerun the client. It should log the best region results (one per region). We would like to see those for the Editor versus the standalone build.

    In worst case, the US region had a hicckup, when your build selected a region.
    I guess it makes sense to add a threshold to the sticky region's ping. Let's say: If the selected best region's ping is larger than 100ms, then ping all regions when the client gets to ping them (on start). This means longer connection times but would make sure a bad selection does not stick.