Exemplo n.º 1
0
 /**
  * Called at object's initialization, after all Awakes.
  */
 void Start()
 {
     // Save references
     controllers = Globals.controllers;
     room        = Globals.room;
     logger      = Globals.logger;
     headset     = Globals.headset;
     boundingBox = Globals.boundingBox;
     lighting    = Globals.lighting;
     mode        = Globals.modeManager;
 }
Exemplo n.º 2
0
    /**
     * Positions the menu in front of the camera
     */
    private void UpdatePosition()
    {
        if (headset == null)
        {
            headset = Globals.headset;
        }

        // Gets the position at 2.5m in front of the headset, along the XZ plane.
        Vector3 headsetFrontPosition = Globals.headset.GetFrontPositionXZ(2.5f);

        // Sets the menu's x and y coordinate to headsetFrontPosition.
        transform.position = new Vector3(headsetFrontPosition.x, transform.position.y, headsetFrontPosition.z);

        // Sets the rotation so that the menu faces the camera
        transform.rotation = Quaternion.LookRotation(transform.position - Globals.headset.transform.position);
    }