Exemple #1
0
    /// <summary>
    /// This function is called when the user starts moving toward the buttons pannel
    /// </summary>
    public void StartGlide()
    {
        if (gliding || frozen || reversing)
        {
            return;
        }

        startTime = Time.time;
        gliding   = true;

        Physics.IgnoreLayerCollision(LayerMask.NameToLayer("Default"), LayerMask.NameToLayer("Utilisateur"), true);
        inputController.lockCamera();

        savedUtilisateurPos = cloneVector3(utilisateur.transform.position);
        savedUtilisateurRot = cloneQuaternion(utilisateur.transform.rotation);
        savedHeadNodeAngle  = inputController.verticalAngle;

        startPos       = savedUtilisateurPos;
        startRot       = savedUtilisateurRot;
        startHeadAngle = savedHeadNodeAngle;

        endPos       = destination.transform.position;
        endRot       = destination.transform.rotation;
        endHeadAngle = 0f;
    }
Exemple #2
0
 /// <summary>
 /// Checks if the menu is in its current state from more than 0.5s and, eventually, changes its state if the user is pressing F12
 /// The user can't move when menu is displayed
 /// </summary>
 void Update()
 {
     timeInCurrentState += MiddleVR.VRKernel.GetDeltaTime();
     if (timeInCurrentState > 0.5)
     {
         if (keyb.IsKeyPressed(MiddleVR.VRK_F12) && menu.activeSelf == false)
         {
             menu.SetActive(true);
             timeInCurrentState = 0.0;
             controller.lockCamera();
         }
         else if (keyb.IsKeyPressed(MiddleVR.VRK_F12) && menu.activeSelf == true)
         {
             menu.SetActive(false);
             timeInCurrentState = 0.0;
             controller.unLockCamera();
         }
         //menu.transform.position = headNode.transform.position;
         //menu.transform.rotation = headNode.transform.rotation;
         //menu.transform.Rotate(90f, 180f, 0);
         //menu.transform.Translate(0, -0.2f, 0f);
     }
 }