示例#1
0
 void Awake()
 {
     if (!HoloHelper.isHololens())
     {
         this.enabled = false;
     }
 }
示例#2
0
 void Awake()
 {
     if (HoloHelper.isHololens())
     {
         this.enabled = false;
         //Debug.Log("HoloReceiver disabed");
     }
 }
 // Use this for initialization
 private void Awake()
 {
     if (!HoloHelper.isHololens())
     {
         this.enabled = false;
         Debug.Log("Not Holo");
     }
 }
示例#4
0
 void Awake()
 {
     if (!HoloHelper.isHololens())
     {
         this.enabled = false;
         //Debug.Log("ReferenceCalibration disabled");
     }
     Instance = this;
 }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        if (!HoloHelper.isHololens())
        {
            return;
        }

        // If the user is in placing mode,
        // update the placement to match the user's gaze.

        if (calibrating)
        {
            CalibrationObject.transform.position = Camera.main.transform.position + Camera.main.transform.TransformDirection(calibrationPosition);
            CalibrationObject.transform.rotation = Camera.main.transform.rotation * Quaternion.Euler(calibrationRotation);;
            //this.transform.position = Camera.main.transform.position + Camera.main.transform.TransformVector(.0f,.0f,-1.5f);
            //    this.transform.rotation = Camera.main.transform.rotation;
            //this.transform.rotation = Camera.main.transform.rotation * Quaternion.Euler(HeadRelativeRotation);
            //this.transform.rotation = Camera.main.transform.rotation * Quaternion.Euler(new Vector3(-35, 0, 0));
        }
    }
示例#6
0
    void Start()
    {
        if (!HoloHelper.isHololens())
        {
            return;
        }

        //WorldAnchorStore.GetAsync(AnchorStoreReady);

        // Add an AudioSource component and set up some defaults
        audioSource             = gameObject.AddComponent <AudioSource>();
        audioSource.playOnAwake = false;
        //audioSource.spatialize = true;
        //audioSource.spatialBlend = 1.0f;
        //audioSource.dopplerLevel = 0.0f;
        //audioSource.rolloffMode = AudioRolloffMode.Custom;

        // Load the Sphere sounds from the Resources folder
        startClip = Resources.Load <AudioClip>("calibrationStart");
        stopClip  = Resources.Load <AudioClip>("calibrationStop");

        //CalibrationObject = transform.FindChild("ProjectorObj").gameObject;
        //CalibrationObject = transform.FindChild("ProjectorObj").gameObject.transform.FindChild("ProjectorMesh").gameObject;
        CalibrationObject  = this.gameObject;
        CalibrationMeshObj = transform.FindChild("ProjectorMesh").gameObject;


        SceneObject = GameObject.Find("SceneObj").gameObject;
#if UNITY_WSA_10_0 && !UNITY_EDITOR
        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) =>
        {
            this.OnSelect();
        };
        //recognizer.StartCapturingGestures();
#endif

        HoloTransform savedTransform = LoadProjectorTransform(ProjectorID);
        if (savedTransform != null)
        {
            Debug.Log("Save found for " + ProjectorID.ToString());
            CalibrationObject.transform.localPosition = savedTransform.position;
            CalibrationObject.transform.localRotation = savedTransform.rotation;
        }

        //if (PlayerPrefs.HasKey(ProjectorID.ToString() + "PosX") && PlayerPrefs.HasKey(ProjectorID.ToString() + "PosY") && PlayerPrefs.HasKey(ProjectorID.ToString() + "PosZ")) {
        //    Vector3 pos = new Vector3(PlayerPrefs.GetFloat(ProjectorID.ToString() + "PosX"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "PosY"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "PosZ"));
        //    Debug.Log("ProjPos " + pos);
        //    CalibrationObject.transform.localPosition = pos;
        //}
        //if (PlayerPrefs.HasKey(ProjectorID.ToString() + "RotX") && PlayerPrefs.HasKey(ProjectorID.ToString() + "RotY") && PlayerPrefs.HasKey(ProjectorID.ToString() + "RotZ") && PlayerPrefs.HasKey(ProjectorID.ToString() + "RotW"))
        //{
        //    Quaternion rot = new Quaternion(PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotX"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotY"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotZ"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotW"));
        //    Debug.Log("ProjRot " + rot);
        //    CalibrationObject.transform.localRotation = rot;
        //}

        if (showCalibration)
        {
            OnShowCalibration();
        }

        RemoteCmdHandler.Instance.RegisterForCmd(RemoteCmdType.MoveRef, ProjectorID.ToString(), MoveProjector);
    }