GetArmDirection() public méthode

public GetArmDirection ( ) : Vector3
Résultat Vector3
Exemple #1
0
        void AlignArmHUD(HandModel handModel)
        {
            ArmHUDgeom.SetActive(true);

            if (targetHandID != handModel.GetInstanceID())
            {
                // Reinitialize ArmHUD alignment
                //Debug.Log ("Reinitialize ArmHUD alignment Time.time = " + Time.time);
                smoothedPosition.reset = true;
                smoothedRotation.reset = true;
                targetHandID           = handModel.GetInstanceID();
            }
            float sqrCos = handModel.GetArmDirection().y;

            sqrCos *= sqrCos;
            float delay = sqrCos * verticalFilterTime + (1f - sqrCos) * horizontalFilterTime;

            //Debug.Log ("delay(sqrCos = " + sqrCos + ", Time.deltaTime = " + Time.deltaTime + ") = " + delay);
            smoothedPosition.delay = delay;
            smoothedRotation.delay = delay;
            Vector3    localArmCenter   = transform.parent.InverseTransformPoint(handModel.GetArmCenter());
            Quaternion localArmRotation = Quaternion.Inverse(transform.parent.rotation) * handModel.GetArmRotation();

            transform.localPosition = smoothedPosition.Update(localArmCenter, Time.deltaTime);
            transform.localRotation = smoothedRotation.Update(localArmRotation, Time.deltaTime);

            if (ArmHUDisOpen == false)            //Change this to state transition from ARMHUDSTATE_NOLEFTHAND -> ARMHUDSTATE_STATUS_ETC
            {
                if (Activate())
                {
                    ArmHUDAnimator.Play("Take 001_Opening");
                    ArmHUDeventsAnimator.Play("WristGraphicsEvents");
                    ArmHUDisOpen = true;
                }
                else
                {
                    ArmHUDState.Change(ARMHUDSTATE_STATUS_ETC);
                    return;
                }
            }
//			ArmHUDbaseLookAtGRP.LookAt(LookTarget);
            Vector3 localEulerAngles = ArmHUDbaseLookAtGRP.localEulerAngles;

            if (ArmHUDisOpen == true)
            {
                if (localEulerAngles.x < 340.0f && localEulerAngles.x > 280.0f)
                {
                    ArmHUDState.Change(ARMHUDSTATE_STATUS_ETC);
                }
                else if (localEulerAngles.x > 26.0f && localEulerAngles.x < 80.0f && ArmHUDState.state != ARMHUDSTATE_PANELVISIBLE)
                {
                    ArmHUDState.Change(ARMHUDSTATE_SETTINGS_ONLY);
                }
            }
//			localEulerAngles.y = 90f;
//			localEulerAngles.z = 0f;
//			ArmHUDbaseLookAtGRP.localEulerAngles = localEulerAngles;
        }
Exemple #2
0
        void AlignArmHUD(HandModel handModel)
        {
            ArmHUDgeom.SetActive(true);

            if (targetHandID != handModel.GetInstanceID()) {
                // Reinitialize ArmHUD alignment
                //Debug.Log ("Reinitialize ArmHUD alignment Time.time = " + Time.time);
                smoothedPosition.reset = true;
                smoothedRotation.reset = true;
                targetHandID = handModel.GetInstanceID();
            }
            float sqrCos = handModel.GetArmDirection().y;
            sqrCos *= sqrCos;
            float delay = sqrCos * verticalFilterTime + (1f - sqrCos) * horizontalFilterTime;
            //Debug.Log ("delay(sqrCos = " + sqrCos + ", Time.deltaTime = " + Time.deltaTime + ") = " + delay);
            smoothedPosition.delay = delay;
            smoothedRotation.delay = delay;
            Vector3 localArmCenter = transform.parent.InverseTransformPoint (handModel.GetArmCenter ());
            Quaternion localArmRotation = Quaternion.Inverse (transform.parent.rotation) * handModel.GetArmRotation ();
            transform.localPosition = smoothedPosition.Update(localArmCenter, Time.deltaTime);
            transform.localRotation = smoothedRotation.Update(localArmRotation, Time.deltaTime);

            if(ArmHUDisOpen == false){//Change this to state transition from ARMHUDSTATE_NOLEFTHAND -> ARMHUDSTATE_STATUS_ETC
                if(Activate()){
                    ArmHUDAnimator.Play("Take 001_Opening");
                    ArmHUDeventsAnimator.Play("WristGraphicsEvents");
                    ArmHUDisOpen = true;
                }
                else{
                    ArmHUDState.Change (ARMHUDSTATE_STATUS_ETC);
                    return;
                }
            }
            //			ArmHUDbaseLookAtGRP.LookAt(LookTarget);
            Vector3 localEulerAngles = ArmHUDbaseLookAtGRP.localEulerAngles;
            if(ArmHUDisOpen == true){
                if(localEulerAngles.x < 340.0f && localEulerAngles.x > 280.0f){
                    ArmHUDState.Change (ARMHUDSTATE_STATUS_ETC);
                }
                else if(localEulerAngles.x >26.0f && localEulerAngles.x < 80.0f && ArmHUDState.state != ARMHUDSTATE_PANELVISIBLE)
                {
                    ArmHUDState.Change (ARMHUDSTATE_SETTINGS_ONLY);
                }
            }
            //			localEulerAngles.y = 90f;
            //			localEulerAngles.z = 0f;
            //			ArmHUDbaseLookAtGRP.localEulerAngles = localEulerAngles;
        }