Beispiel #1
0
    /// <summary>
    /// Called when a remote user sends a head transform.
    /// </summary>
    /// <param name="msg"></param>
    void UpdateHeadTransform(NetworkInMessage msg)
    {
        // Parse the message
        long userID = msg.ReadInt64();

        Vector3 headPos = customMessages.ReadVector3(msg);

        Quaternion headRot = customMessages.ReadQuaternion(msg);

        // If head info does not exist for this userID, a new one will be created
        // with the call to GetRemoteHeadInfo.
        RemoteHeadInfo headInfo = GetRemoteHeadInfo(userID);

        if (headInfo.HeadObject != null)
        {
            // If we don't have our anchor established, don't draw the remote head.
            headInfo.HeadObject.SetActive(headInfo.Anchored);

            headInfo.HeadObject.transform.localPosition = headPos;

            //headInfo.HeadObject.transform.localRotation = headRot;

            /* Our code for testing */
            Transform anchor = ImportExportAnchorManager.Instance.gameObject.transform;
            Vector3   remoteHealthDisplayPos = anchor.TransformPoint(headPos);

            GameObject healthDisplay = headInfo.HeadObject;
            healthDisplay.transform.parent   = this.transform;
            healthDisplay.transform.position = remoteHealthDisplayPos;
        }

        headInfo.Anchored = (msg.ReadByte() > 0);
    }
Beispiel #2
0
/// <summary>
/// Called when a remote user sends a head transform.
/// </summary>
/// <param name="msg"></param>
    void UpdateHeadTransform(NetworkInMessage msg)
    {
        // Parse the message
        long userID = msg.ReadInt64();

        Vector3 headPos = customMessages.ReadVector3(msg);

        Quaternion headRot = customMessages.ReadQuaternion(msg);

        Vector3 headTarget   = customMessages.ReadVector3(msg);
        Vector3 targetNormal = customMessages.ReadVector3(msg);

        RemoteHeadInfo headInfo = GetRemoteHeadInfo(userID);


        Vector3 A = new Vector3();
        Vector3 B = new Vector3();

        if (headInfo.HeadObject != null)
        {
            // If we don't have our anchor established, don't draw the remote head.
            headInfo.HeadObject.SetActive(headInfo.Anchored);

            headInfo.HeadObject.transform.localPosition = headPos + headRot * headInfo.headObjectPositionOffset;

            headInfo.HeadObject.transform.localRotation = headRot;

            //if this manager add into volume
            if (AppStateManager.Instance.isCommandCenter)
            {
                //update head
                if (!OctreeManager.Instance.GetMarkers(headTarget, ref A, ref B))
                {
                    OctreeManager.Instance.Add(headTarget);


                    CustomMessages.Instance.SendMarkerList(headTarget, targetNormal, 0x1);
                    GameObject a = Instantiate(MarkerPrefab, headTarget, Quaternion.identity);

                    // Orient the cursor to match the surface being gazed at.
                    a.transform.up = GazeManager.Instance.Normal;
                }
            }
        }

        headInfo.Anchored = (msg.ReadByte() > 0);
    }
    /// <summary>
    /// Called when a remote user sends a head transform.
    /// </summary>
    /// <param name="msg"></param>
    void UpdateHeadTransform(NetworkInMessage msg)
    {
        // Parse the message
        long userID = msg.ReadInt64();

        Vector3 headPos = customMessages.ReadVector3(msg);

        Quaternion headRot = customMessages.ReadQuaternion(msg);

        RemoteHeadInfo headInfo = GetRemoteHeadInfo(userID);

        if (headInfo.HeadObject != null)
        {
            // If we don't have our anchor established, don't draw the remote head.
            headInfo.HeadObject.SetActive(headInfo.Anchored);

            headInfo.HeadObject.transform.localPosition = headPos + headRot * headInfo.headObjectPositionOffset;

            headInfo.HeadObject.transform.localRotation = headRot;
        }

        headInfo.Anchored = (msg.ReadByte() > 0);
    }