/// <summary> /// Returns the mass center of all the players /// </summary> private Vector3 PlayersMassCenter() { Vector3 massCenter = Vector3.zero; float totalMass = 0; foreach (KeyValuePair <string, ConnectedPlayer> p in _players) { ConnectedPlayer player = p.Value; float pmass = player.GetComponent <Rigidbody>().mass; Vector3 pcenter = player.GetComponent <Rigidbody>().worldCenterOfMass; massCenter = (totalMass * massCenter + pmass * pcenter) / (totalMass + pmass); totalMass += pmass; } return(massCenter); }
void Start() { cp.AddLocalPlayer(); cp.GetComponent <PhotonView>().RPC("UpdatePlayerList", RpcTarget.OthersBuffered, PhotonNetwork.NickName); }