コード例 #1
0
 /// <summary>
 /// Sets pointer states to turn off all but the poke pointer
 /// </summary>
 public void SetFingerOnly()
 {
     PointerUtils.SetHandPokePointerBehavior(PointerBehavior.Default, Handedness.Any);
     PointerUtils.SetHandGrabPointerBehavior(PointerBehavior.AlwaysOff, Handedness.Any);
     PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff, Handedness.Any);
     PointerUtils.SetMotionControllerRayPointerBehavior(PointerBehavior.AlwaysOff, Handedness.Any);
     PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOff);
 }
コード例 #2
0
        void SetGameMode(GameMode modeToSet)
        {
            logger.Log($"SetGameMode {modeToSet}");

            currentGameMode = modeToSet;

            if (currentGameMode == GameMode.Playing)
            {
                // Turn off the pointer because the Gun takes care of interactions
                PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff);
            }
            if (currentGameMode == GameMode.Menu || currentGameMode == GameMode.Credits)
            {
                // Else turn the pointer back on
                PointerUtils.SetHandRayPointerBehavior(PointerBehavior.Default);
            }

            Menu.SetActive(currentGameMode == GameMode.Menu);
            Game.SetActive(currentGameMode == GameMode.Playing);
            Credits.SetActive(currentGameMode == GameMode.Credits);
        }
コード例 #3
0
 public void DisableHandRays()
 {
     PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff);
 }
コード例 #4
0
 /// <summary>
 /// Sets the <see cref="Microsoft.MixedReality.Toolkit.Input.PointerBehavior"/> for all hand rays.
 /// <param name="isEnabled">If true, behavior will be set to Default.
 /// Otherwise it will be set to AlwaysOff</param>
 /// </summary>
 public void SetHandRayEnabled(bool isEnabled)
 {
     PointerUtils.SetHandRayPointerBehavior(isEnabled ? PointerBehavior.Default : PointerBehavior.AlwaysOff,
                                            Handedness.Any);
 }
コード例 #5
0
        // Start is called before the first frame update
        void Start()
        {
            handJointService = CoreServices.GetInputSystemDataProvider <IMixedRealityHandJointService>();
            if (handJointService == null)
            {
                Debug.LogError("Can't get IMixedRealityHandJointService.");
                return;
            }

            dataProviderAccess = CoreServices.InputSystem as IMixedRealityDataProviderAccess;
            if (dataProviderAccess == null)
            {
                Debug.LogError("Can't get IMixedRealityDataProviderAccess.");
                return;
            }

            // ハンドレイを非表示にする
            PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff);

            /*
             * Mesh mesh = new Mesh();
             *
             * // 頂点座標情報
             * mesh.vertices = new Vector3[] {
             *  new Vector3(   0f,  1f, 0f),
             *  new Vector3( 0.5f,  0f, 0f),
             *  new Vector3(-0.5f,  0f, 0f),
             *  new Vector3(   1f, -1f, 0f),
             *  new Vector3(   0f, -1f, 0f),
             *  new Vector3(  -1f, -1f, 0f)
             * };
             *
             * //各頂点にUV座標を設定する
             * mesh.uv = new Vector2[] {
             *  new Vector2 ( 0.5f,   1f),
             *  new Vector2 (0.75f, 0.5f),
             *  new Vector2 (0.25f, 0.5f),
             *  new Vector2 (   1f,   0f),
             *  new Vector2 ( 0.5f,   0f),
             *  new Vector2 (   0f,   0f)
             * };
             *
             * // 頂点を結ぶ順番情報
             * mesh.triangles = new int[] {
             *  0, 1, 2,
             *  1, 3, 4,
             *  2, 4, 5
             * };
             *
             * // 三角形と頂点からメッシュの法線を再計算する
             * mesh.RecalculateNormals();
             *
             * // バウンディングボリュームを再計算する
             * mesh.RecalculateBounds();
             *
             * // MeshRendererにメッシュ情報を渡すために必要
             * MeshFilter filter = GetComponent<MeshFilter>();
             * filter.sharedMesh = mesh;
             * filter.sharedMesh.name = "SampleMesh";
             *
             * // マテリアルを設定する
             * MeshRenderer renderer = GetComponent<MeshRenderer>();
             * renderer.material = mat;
             */
        }