示例#1
0
 public static Quaternion GetHeadRotation(int ID)
 {
     return(CAVE2Manager.GetHeadRotation(ID));
 }
    // Update is called once per frame
    void Update()
    {
        wandPosition = CAVE2Manager.GetWandPosition(wandID);
        wandRotation = CAVE2Manager.GetWandRotation(wandID);

        headPosition = CAVE2Manager.GetHeadPosition(headID);
        headRotation = CAVE2Manager.GetHeadRotation(headID).eulerAngles;

        if (headPosition.y == 0)
        {
            Debug.LogWarning("OmicronPlayerController: Head is at height (Y) 0.0 - This should never happen! Check your tracking system or enable mocap emulation in CAVE2Manager.");
        }

        if (!freezeMovement)
        {
            forward  = CAVE2Manager.GetAxis(wandID, forwardAxis);
            forward *= movementScale;

            strafe  = CAVE2Manager.GetAxis(wandID, strafeAxis);
            strafe *= movementScale;

            lookAround.x  = CAVE2Manager.GetAxis(wandID, lookUDAxis);
            lookAround.x *= movementScale;
            lookAround.y  = CAVE2Manager.GetAxis(wandID, lookLRAxis);
            lookAround.y *= movementScale;

            vertical  = CAVE2Manager.GetAxis(wandID, verticalAxis);
            vertical *= movementScale;
        }

        freeflyButtonDown = CAVE2Manager.GetButton(wandID, freeFlyButton);

        if (CAVE2Manager.GetButtonDown(wandID, freeFlyToggleButton))
        {
            navMode++;
            if ((int)navMode > 2)
            {
                navMode = 0;
            }

            SetNavigationMode((int)navMode);
        }

        if (CAVE2Manager.GetButtonDown(wandID, autoLevelButton))
        {
            transform.localEulerAngles = new Vector3(0, transform.localEulerAngles.y, 0);
        }

        if (CAVEFloor && !CAVEFloor.activeSelf)
        {
            CAVEFloor.SetActive(true);
        }

        if (CAVEFloor && showCAVEFloorOnlyOnMaster && CAVEFloor.activeSelf && !CAVE2Manager.IsMaster())
        {
            CAVEFloor.SetActive(false);
        }
        else if (CAVEFloor && !showCAVEFloorOnlyOnMaster && !CAVEFloor.activeSelf)
        {
            CAVEFloor.SetActive(true);
        }
    }