diff --git a/Assets/Scripts/Calibrator.cs b/Assets/Scripts/Calibrator.cs index e82e92d7..98c85985 100644 --- a/Assets/Scripts/Calibrator.cs +++ b/Assets/Scripts/Calibrator.cs @@ -173,7 +173,7 @@ private static void CalibrateLeg(Settings settings, Transform FootTransform, IKS leg.bendGoal = null; leg.bendGoalWeight = 0f; } - + public static IEnumerator CalibrateScaled(Transform trackerRoot, VRIK ik, Settings settings, Transform HMDTransform, Transform PelvisTransform = null, Transform LeftHandTransform = null, Transform RightHandTransform = null, Transform LeftFootTransform = null, Transform RightFootTransform = null) { if (!ik.solver.initiated) @@ -188,6 +188,9 @@ public static IEnumerator CalibrateScaled(Transform trackerRoot, VRIK ik, Settin yield break; } + //トラッカーのルートスケールを初期値に戻す + trackerRoot.localScale = new Vector3(1.0f, 1.0f, 1.0f); + // モデルのポジションを手と手の中心位置に移動 var centerposition = Vector3.Lerp(LeftHandTransform.position, RightHandTransform.position, 0.5f); ik.references.root.position = new Vector3(centerposition.x, ik.references.root.position.y, centerposition.z); diff --git a/Assets/Scripts/ControlWPFWindow.cs b/Assets/Scripts/ControlWPFWindow.cs index 4a5028eb..92a5ebf2 100644 --- a/Assets/Scripts/ControlWPFWindow.cs +++ b/Assets/Scripts/ControlWPFWindow.cs @@ -1196,7 +1196,57 @@ private void CheckKey(KeyConfig config, bool isKeyDown) } if (enable) { - DoKeyAction(action); + //手の操作の場合、別の手の操作キーが押されたままだったらそちらを優先して、離す処理は飛ばす + var skipKeyUp = false; + + var doKeyActions = new List(); + foreach (var downaction in CurrentSettings.KeyActions?.OrderBy(d => d.KeyConfigs.Count()).Where(d => d.FaceAction == action.FaceAction && d.HandAction == action.HandAction && d.FunctionAction == action.FunctionAction)) + {//キーの少ない順に実行して、同時押しと被ったとき同時押しを後から実行して上書きさせる + //if (action.KeyConfigs.Count == CurrentKeyConfigs.Count) + //{ //別々の機能を同時に押す場合もあるのでキーの数は見てはいけない + var downenable = true; + foreach (var key in downaction.KeyConfigs) + { + if (CurrentKeyConfigs.Where(d => d.IsEqualKeyCode(key) == true).Any() == false) + { + //キーが含まれてないとき + downenable = false; + } + } + if (downenable) + {//現在押してるキーの中にすべてのキーが含まれていた + if (downaction.IsKeyUp) + { + //キーを離す操作の時はキューに入れておく + CurrentKeyUpActions.Add(downaction); + } + else + { + doKeyActions.Add(downaction); + } + } + //} + } + if (doKeyActions.Any()) + { + skipKeyUp = true; //優先処理があったので、KeyUpのActionは無効 + var tmpDownActions = new List(doKeyActions); + foreach (var downaction in tmpDownActions) + { + foreach (var target in tmpActions.Where(d => d != downaction)) + { + if (target.KeyConfigs.ContainsArray(downaction.KeyConfigs)) + {//更に複数押しのキー設定が有効な場合、少ないほうは無効(上書きされてしまうため) + doKeyActions.Remove(downaction); + } + } + } + foreach (var downaction in doKeyActions) + {//残った処理だけ実行 + DoKeyAction(downaction); + } + } + if (skipKeyUp == false) DoKeyAction(action); CurrentKeyUpActions.Remove(action); } } diff --git a/Assets/Scripts/OVRControllerAction.cs b/Assets/Scripts/OVRControllerAction.cs index eb00ebfd..bfa46e22 100644 --- a/Assets/Scripts/OVRControllerAction.cs +++ b/Assets/Scripts/OVRControllerAction.cs @@ -10,7 +10,7 @@ public class OVRControllerAction : MonoBehaviour { - public InputField inputField; + // public InputField inputField; public EventHandler KeyDownEvent; public EventHandler KeyUpEvent; diff --git a/ControlWindowWPF/ControlWindowWPF/ShortcutKeyWindow.xaml b/ControlWindowWPF/ControlWindowWPF/ShortcutKeyWindow.xaml index 8eb8cd2a..057d4108 100644 --- a/ControlWindowWPF/ControlWindowWPF/ShortcutKeyWindow.xaml +++ b/ControlWindowWPF/ControlWindowWPF/ShortcutKeyWindow.xaml @@ -8,20 +8,20 @@ Title="ショートカットキー設定" SizeToContent="Height" Width="800"> - + - + - + - + @@ -33,13 +33,13 @@ - + - + - + @@ -48,7 +48,10 @@ -