How to sync box trigger?

Options
Hello i wanna sync my script because it's a trigger, how can i do this?
my script:
using UnityEngine;
public class coolhelicopter : MonoBehaviour {
    public Animator animator;
    void OnTriggerEnter(Collider other) {
        if (other.gameObject.CompareTag("Player")) {
            animator.SetTrigger("EYYY");
        }
    }
}

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @FedericoDeveloper,

    Thank you for choosing Photon!

    No need to sync the trigger.
    Sync the objects and sync the animator using Photon observable components.

    You could add photonView.IsMine check or player.IsLocal checks before setting animator trigger.

    Also animator triggers are tricky to sync.
  • JohnTube wrote: »
    Hi @FedericoDeveloper,

    Thank you for choosing Photon!

    No need to sync the trigger.
    Sync the objects and sync the animator using Photon observable components.

    You could add photonView.IsMine check or player.IsLocal checks before setting animator trigger.

    Also animator triggers are tricky to sync.

    Hello i'm using photon transform view and it seems that it's a bit delayed which causes some issues like this https://imgur.com/a/yjLUBWa
    There is a trigger that puts the player prefab inside the helicopter so they don't fall.
    Any solution?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @FedericoDeveloper,

    Did you try PhotonTransformViewClassic?
    Or maybe implement your own?
  • JohnTube wrote: »
    Hi @FedericoDeveloper,

    Did you try PhotonTransformViewClassic?
    Or maybe implement your own?

    Hello, I tried photon transform view classic, And when player enter the trigger that keeps them on the moving platform the remote player, This is the script and heres a screenshot of the bug, Sometimes it works sometimes it doesnt, and the settings of photon animator view, photon transform view classic (PS: If a player joins, to them the platform will be reseted which means that it will not move for them unless he triggers it again and he will see players flying but in reality they are in the platform, i'm also using animator.play not the trigger)
    using UnityEngine;
    public class playerplatform : MonoBehaviour {
        public GameObject platform;
        void OnTriggerEnter(Collider other) {
            if (other.tag == "Player") {
                other.transform.parent = platform.transform;
            }
        }
        void OnTriggerExit(Collider other) {
            if (other.tag == "Player") {
                other.transform.parent = null;
            }
        }
    }
    
    https://imgur.com/a/YVCAXpa
    https://imgur.com/a/gsVtYyQ
    https://imgur.com/a/TmGbLeD
  • Any idea?
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2020
    Options
    Hi @FedericoDeveloper,

    I'm really not an expert in this.
    Maybe this is a teleport issue?
    Not sure if there is an option to enable/allow teleport?

    Also, Photon does not automatically sync transform parenting in hierarchy, so maybe you should do that per RPC.

    Unrelated note: you should revert to using CompareTag as in the original post.
  • @JohnTube This might be a teleport issue,
    JohnTube wrote: »
    Also, Photon does not automatically sync transform parenting in hierarchy, so maybe you should do that per RPC.
    Is there any example so i can see?
  • Hello?