Ejemplo n.º 1
0
    public void UpdatePlayerPos(SocketIOEvent e)
    {
        UpdatePlayerPositionMessage data = JsonUtility.FromJson <UpdatePlayerPositionMessage>(e.data.ToString());

        GameObject player = playerList[data.uid];

        player.GetComponent <ConnectedPlayerManager>().UpdatePosition(data.headPos, data.headRot, data.handRightPos, data.handRightRot, data.handLeftPos, data.handLeftRot);
    }
Ejemplo n.º 2
0
    public void SendPlayerPosition()
    {
        UpdatePlayerPositionMessage upp = new UpdatePlayerPositionMessage()
        {
            uid          = playerId,
            headPos      = cameraHead.transform.position,
            headRot      = cameraHead.transform.rotation,
            handRightPos = controllerRight.transform.position,
            handRightRot = controllerRight.transform.rotation,
            handLeftPos  = controllerLeft.transform.position,
            handLeftRot  = controllerLeft.transform.rotation
        };

        string     st   = JsonUtility.ToJson(upp);
        JSONObject data = new JSONObject(st);

        socket.Emit("PostPlayerPosition", data);
    }