示例#1
0
        /// <summary>
        /// Start a calibration automatically on Awake().
        /// </summary>
        void Awake()
        {
            posesAction = SteamVR_Events.NewPosesAction(OnNewPoses);
            module      = GetComponent <ViveModule>() as ViveModule;

            if (!Valid)
            {
                Debug.Log("Holojam.Vive.ViveCalibrator: Build state not valid for calibration");
                return;
            }

            if (!module.cameraRig)
            {
                Network.RemoteLogger.Log(
                    "Calibration failed; ViveModule camera rig not assigned!"
                    );
                return;
            }

            // Cache the centroid position and rotation for future offset
            cachedPosition = module.cameraRig.transform.localPosition;
            cachedRotation = module.cameraRig.transform.localRotation;

            StartCoroutine(WaitToCalibrate());
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(cameraRig);

            ViveModule module = (ViveModule)serializedObject.targetObject;

            if (GUILayout.Button("Configure"))
            {
                module.Configure();
            }

            serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// Initializes, and caches the position/rotation of the centroid.
        /// </summary>
        void Awake()
        {
            posesAction = SteamVR_Events.NewPosesAction(OnNewPoses);
            module      = GetComponent <ViveModule>() as ViveModule;

            if (!module.cameraRig)
            {
                Debug.Log("Holojam.Vive.ViveCalibrator: ViveModule camera rig not assigned!");
                return;
            }

            cachedPosition     = module.cameraRig.transform.localPosition;
            cachedRotation     = module.cameraRig.transform.localRotation;
            calibratedPosition = cachedPosition;
            calibratedRotation = cachedRotation;

            Tools.InfoPanel.SetString("calibrator", "Calibrator: waiting");
        }
示例#4
0
 void Awake()
 {
     module = GetComponent <ViveModule>() as ViveModule;
 }