Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Third Party Photon ragdoll

Discussion in 'Multiplayer' started by MICKDOii, Nov 14, 2015.

  1. MICKDOii

    MICKDOii

    Joined:
    Jan 12, 2015
    Posts:
    69
    I've been slowly putting this together and working out the bugs but i have an issue.

    There are 2 players.

    HostClient = Player 1

    Client = Player 2

    When the HostClient hits the cube with tag "Cube"

    it instantiates 1 ragdoll fine...with as fine as i can get it still needs some work.

    but when Client hits a cube with tag cube it instantiates 2 ragdolls.

    Any Ideas.

    Code (CSharp):
    1. public class DisableOnCollide : Photon.MonoBehaviour
    2. {
    3.     public CapsuleCollider Trigger;
    4.     public CharacterController CC;
    5.    
    6.     public GameObject ragdoll;
    7.     public GameObject Child;
    8.  
    9.  
    10.  
    11.  
    12.  
    13.  
    14.     void OnTriggerEnter(Collider collision)
    15.     {
    16.         if (photonView.isMine & collision.gameObject.tag == "Cube")
    17.      
    18.  
    19.  
    20.  
    21.  
    22.             Physics.IgnoreLayerCollision(8, 8, true);
    23.  
    24.         Trigger.GetComponent<CapsuleCollider>().enabled = false;
    25.         CC.GetComponent<CharacterController>().enabled = false;
    26.         PhotonNetwork.Destroy(Child.gameObject);
    27.  
    28.  
    29.         Vector3 pos = new Vector3(transform.position.x, transform.position.y - 0.96f, transform.position.z);
    30.  
    31.            ragdoll = PhotonNetwork.Instantiate("ragdoll", pos, Quaternion.identity, 0) as GameObject;
    32.  
    33.             //Vector3 pos = new Vector3(transform.position.x, transform.position.y - 0.96f, transform.position.z);
    34.             //ragdoll = PhotonNetwork.Instantiate("ragdoll", pos, transform.rotation) as GameObject;
    35.  
    36.          
    37.  
    38.          
    39.  
    40.         }
    41.        
    42.     }
     
  2. ricardoferry83

    ricardoferry83

    Joined:
    Mar 24, 2022
    Posts:
    2
    Deve haver algum outro script com o mesmo comando ragdoll