public void SyncRotation(Quaternion rotation)
 {
     //Debug.Log("SyncPosition on " + gameObject.name + " to " + position);
     if (!CAVE2Manager.IsMaster())
     {
         transform.rotation = rotation;
     }
 }
 public void SyncPosition(Vector3 position)
 {
     //Debug.Log("SyncPosition on " + gameObject.name + " to " + position);
     if (!CAVE2Manager.IsMaster())
     {
         transform.position = position;
     }
 }
示例#3
0
	// Initializations
	public void Start()
	{
		omicronListener = new EventListener(this);
		omicronManager = new OmicronConnectorClient(omicronListener);
		
		eventList = new ArrayList();
		
		if( connectToServer && CAVE2Manager.IsMaster() )
		{
			ConnectToServer();
		}
	}// start
示例#4
0
    void Update()
    {
        if (playerController == null && cave2manager.GetPlayerController(0) != null)
        {
            playerController = cave2manager.GetPlayerController(0).GetComponent <OmicronPlayerController>();
        }
        if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && Input.GetKeyDown(KeyCode.F11))
        {
            showGUI = !showGUI;
        }

        bool isMaster = CAVE2Manager.IsMaster();

        if (showFPS && ((showOnlyOnMaster && isMaster) || !showOnlyOnMaster))
        {
            timeleft -= Time.deltaTime;
            accum    += Time.timeScale / Time.deltaTime;
            ++frames;

            // Interval ended - update GUI text and start new interval
            if (timeleft <= 0.0)
            {
                // display two fractional digits (f2 format)
                float  fps    = accum / frames;
                string format = System.String.Format("{0:F2} FPS", fps);

                if (GetComponent <GUIText>())
                {
                    GetComponent <GUIText>().text = format;

                    if (fps < 30)
                    {
                        GetComponent <GUIText>().material.color = Color.yellow;
                    }
                    else
                    if (fps < 10)
                    {
                        GetComponent <GUIText>().material.color = Color.red;
                    }
                    else
                    {
                        GetComponent <GUIText>().material.color = Color.green;
                    }
                }
                if (GetComponent <TextMesh>())
                {
                    GetComponent <TextMesh>().text = format;

                    if (fps < 30)
                    {
                        GetComponent <TextMesh>().color = Color.yellow;
                    }
                    else
                    if (fps < 10)
                    {
                        GetComponent <TextMesh>().color = Color.red;
                    }
                    else
                    {
                        GetComponent <TextMesh>().color = Color.green;
                    }
                }

                //	DebugConsole.Log(format,level);
                timeleft = FPS_updateInterval;
                accum    = 0.0F;
                frames   = 0;
            }
        }
        else
        {
            if (GetComponent <GUIText>())
            {
                GetComponent <GUIText>().text = "";
            }
            if (GetComponent <TextMesh>())
            {
                GetComponent <TextMesh>().text = "";
            }
        }
    }
示例#5
0
 public static bool IsMaster()
 {
     return(CAVE2Manager.IsMaster());
 }
    // 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);
        }
    }