Exemple #1
0
 public void TangoPoseStateChanged(TangoPoseStates currentState)
 {
     if (tangoPoseStatedChanged != null)
     {
         tangoPoseStatedChanged(currentState);
     }
 }
    /// <summary>
    /// Updates the transform from a Tango pose data.
    /// </summary>
    /// <param name="pose">Tango pose.</param>
    private void UpdateTransform(TangoPoseData pose)
    {
        Vector3 tangoPosition = new Vector3((float)pose.translation[0],
                                            (float)pose.translation[2],
                                            (float)pose.translation[1]);

        Quaternion tangoRotation = new Quaternion((float)pose.orientation[0],
                                                  (float)pose.orientation[2], // these rotation values are swapped on purpose
                                                  (float)pose.orientation[1],
                                                  (float)pose.orientation[3]);

        Quaternion axisFix = Quaternion.Euler(-tangoRotation.eulerAngles.x,
                                              -tangoRotation.eulerAngles.z,
                                              tangoRotation.eulerAngles.y);

        transform.rotation = startingRotation * (rotationFix * axisFix);
        transform.position = (startingRotation * tangoPosition) + positionOffest;

        // Fire the state change event.
        if (preTangoState != Statics.currentTangoState)
        {
            EventManager.Instance.SendTangoPoseStateChanged(Statics.currentTangoState);
        }
        preTangoState = Statics.currentTangoState;
    }
Exemple #3
0
 /// <summary>
 /// Fire the TangoPoseStateChanged event.
 /// </summary>
 /// <param name="currentState">Current state.</param>
 public void SendTangoPoseStateChanged(TangoPoseStates currentState)
 {
     if (TangoPoseStateChanged != null)
     {
         TangoPoseStateChanged(currentState);
     }
 }
    // Update is called once per frame
    void Update()
    {
        TangoPoseData pose;

        if (Statics.currentTangoState == TangoPoseStates.Running)
        {
            if (adfPose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID)
            {
                pose = adfPose;
            }
            else
            {
                return;
            }
        }
        else if (Statics.currentTangoState == TangoPoseStates.Relocalizing)
        {
            if (motionTrackingPose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID)
            {
                pose = motionTrackingPose;
            }
            else
            {
                return;
            }
        }
        else
        {
            return;
        }

        Vector3 tangoPosition = new Vector3((float)pose.translation [0],
                                            (float)pose.translation [2],
                                            (float)pose.translation [1]);

        Quaternion tangoRotation = new Quaternion((float)pose.orientation [0],
                                                  (float)pose.orientation [2], // these rotation values are swapped on purpose
                                                  (float)pose.orientation [1],
                                                  (float)pose.orientation [3]);

        Quaternion axisFix = Quaternion.Euler(-tangoRotation.eulerAngles.x,
                                              -tangoRotation.eulerAngles.z,
                                              tangoRotation.eulerAngles.y);

        transform.rotation = startingRotation * (rotationFix * axisFix);
        transform.position = (startingRotation * tangoPosition) + positionOffest;

        // Fire the state change event.
        if (preTangoState != Statics.currentTangoState)
        {
            EventManager.instance.TangoPoseStateChanged(Statics.currentTangoState);
        }
        preTangoState = Statics.currentTangoState;
    }
Exemple #5
0
 void TangoStateChanged(TangoPoseStates curState)
 {
     if (curState == TangoPoseStates.Running)
     {
         SetAllBuildingActive(true);
     }
     else
     {
         SetAllBuildingActive(false);
     }
 }
 void TangoPoseStateChanged(TangoPoseStates curState) {
     if (curState == TangoPoseStates.Connecting) {
         SetPanelShown(true);
         textMesh.text = Statics.uiPanelConnectingService;
     }
     else if (curState == TangoPoseStates.Relocalizing) {
         SetPanelShown(true);
         textMesh.text = Statics.uiPanelRelocalizing;
     }
     else if (curState == TangoPoseStates.Running) {
         SetPanelShown(false);
     }
 }
 void TangoPoseStateChanged(TangoPoseStates curState)
 {
     if (curState == TangoPoseStates.Connecting)
     {
         SetPanelShown(true);
         textMesh.text = Statics.uiPanelConnectingService;
     }
     else if (curState == TangoPoseStates.Relocalizing)
     {
         SetPanelShown(true);
         textMesh.text = Statics.uiPanelRelocalizing;
     }
     else if (curState == TangoPoseStates.Running)
     {
         SetPanelShown(false);
     }
 }
    /// <summary>
    /// Updates the transform from a Tango pose data.
    /// </summary>
    /// <param name="pose">Tango pose.</param>
    private void UpdateTransform(TangoPoseData pose)
    {
        Vector3 tangoPosition = new Vector3((float)pose.translation[0],
                                            (float)pose.translation[2],
                                            (float)pose.translation[1]);

        Quaternion tangoRotation = new Quaternion((float)pose.orientation[0],
                                                  (float)pose.orientation[2], // these rotation values are swapped on purpose
                                                  (float)pose.orientation[1],
                                                  (float)pose.orientation[3]);

        Quaternion axisFix = Quaternion.Euler(-tangoRotation.eulerAngles.x,
                                              -tangoRotation.eulerAngles.z,
                                              tangoRotation.eulerAngles.y);

        transform.rotation = startingRotation * (rotationFix * axisFix);
        transform.position = (startingRotation * tangoPosition) + positionOffest;

        // Fire the state change event.
        if (preTangoState != Statics.currentTangoState)
        {
            EventManager.Instance.SendTangoPoseStateChanged(Statics.currentTangoState);
        }
        preTangoState = Statics.currentTangoState;
    }
 void TangoStateChanged(TangoPoseStates curState) {
     if (curState == TangoPoseStates.Running) {
         SetAllBuildingActive(true);
     } else {
         SetAllBuildingActive(false);
     }
 }
 public void TangoPoseStateChanged(TangoPoseStates currentState) {
     if (tangoPoseStatedChanged != null) {
         tangoPoseStatedChanged(currentState);
     }
 }
    // Update is called once per frame
    void Update () {
        TangoPoseData pose;
        if (Statics.currentTangoState == TangoPoseStates.Running){
            if (adfPose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID) {
                pose = adfPose;
            }
            else {
                return;
            }
        } else if (Statics.currentTangoState == TangoPoseStates.Relocalizing) {
            if (motionTrackingPose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID) {
                pose = motionTrackingPose;
            }
            else {
                return;
            }
        } else {
            return;
        }

        Vector3 tangoPosition = new Vector3((float)pose.translation [0],
                                    (float)pose.translation [2],
                                    (float)pose.translation [1]);
        
        Quaternion tangoRotation = new Quaternion((float)pose.orientation [0],
                                       (float)pose.orientation [2], // these rotation values are swapped on purpose
                                       (float)pose.orientation [1],
                                       (float)pose.orientation [3]);

        Quaternion axisFix = Quaternion.Euler(-tangoRotation.eulerAngles.x,
                                              -tangoRotation.eulerAngles.z,
                                              tangoRotation.eulerAngles.y);
        
        transform.rotation = startingRotation * (rotationFix * axisFix);
        transform.position = (startingRotation * tangoPosition) + positionOffest;

        // Fire the state change event.
        if (preTangoState != Statics.currentTangoState) {
            EventManager.instance.TangoPoseStateChanged(Statics.currentTangoState);
        }
        preTangoState = Statics.currentTangoState;
    }