private static void OverrideButton(Texture texture, GestureManager manager, GestureHand hand, int i) { if (GUILayout.Button(texture, GestureManagerStyles.PlusButton, GUILayout.Width(15), GUILayout.Height(15))) { RequestGestureDuplication(manager, hand, i); } }
public void AddHand(GestureHand hand) { switch (hand) { case GestureHand.LEFT: if (curHands == GestureHand.RIGHT) { leftNodes = new List <Vector3>(); curHands = GestureHand.BOTH; } else { throw new System.Exception("Unable to add this hand"); } break; case GestureHand.RIGHT: if (curHands == GestureHand.LEFT) { rightNodes = new List <Vector3>(); curHands = GestureHand.BOTH; } else { throw new System.Exception("Unable to add this hand"); } break; case GestureHand.BOTH: throw new System.Exception("Should not add both hands here"); } }
public int NumNodes(GestureHand hand) { switch (hand) { case GestureHand.LEFT: if (leftNodes != null) { return(leftNodes.Count); } else { throw new System.Exception("This hand does not exist in this gesture"); } case GestureHand.RIGHT: if (rightNodes != null) { return(rightNodes.Count); } else { throw new System.Exception("This hand does not exist in this gesture"); } default: throw new System.Exception("Unable to get the number of nodes for more than one hand"); } }
internal static Vector3 GetHandPosition_Internal(GestureHand hand) { Vector3 result; HolographicEmulation.INTERNAL_CALL_GetHandPosition_Internal(hand, out result); return(result); }
/* * Layout Builders */ internal static int OnCheckBoxGuiHand(GestureManager manager, GestureHand hand, int position, Func <int, int> onNone) { var gesture = new bool[8]; var texture = EditorGUIUtility.isProSkin ? GestureManagerStyles.PlusTexturePro : GestureManagerStyles.PlusTexture; gesture[position] = true; for (var i = 1; i < 8; i++) { GUILayout.BeginHorizontal(); GUILayout.Label(manager.GetFinalGestureName(hand, i)); GUILayout.FlexibleSpace(); gesture[i] = GUILayout.Toggle(gesture[i], ""); if (!manager.Module.HasGestureBeenOverridden(i)) { OverrideButton(texture, manager, hand, i); } else { GUILayout.Space(35); } GUILayout.EndHorizontal(); } for (var i = 0; i < gesture.Length; i++) { if (!gesture[i] || position == i) { continue; } for (var ix = 0; ix < gesture.Length; ix++) { if (ix != i) { gesture[ix] = false; } } } for (var i = 0; i < gesture.Length; i++) { if (gesture[i]) { return(i); } } return(onNone(position)); }
public float GetRotation(GestureHand hand) { switch (hand) { case GestureHand.LEFT: return(leftRotation); case GestureHand.RIGHT: return(rightRotation); default: return(leftRotation + rightRotation / 2); } }
void OnGUI() { if (!CheckOperatingSystem()) { EditorGUILayout.HelpBox("You must be running Windows build 14318 or later to use Holographic Simulation or Remoting.", MessageType.Warning); return; } if (!IsWindowsMixedRealityCurrentTarget()) { EditorGUILayout.HelpBox("You must enable Virtual Reality support in settings and add Windows Mixed Reality to the devices to use Holographic Emulation.", MessageType.Warning); return; } EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(m_InPlayMode); DrawRemotingMode(); EditorGUI.EndDisabledGroup(); switch (m_Mode) { case EmulationMode.RemoteDevice: EditorGUI.BeginDisabledGroup(IsConnectedToRemoteDevice()); RemotingPreferencesOnGUI(); EditorGUI.EndDisabledGroup(); ConnectionStateGUI(); break; case EmulationMode.Simulated: EditorGUI.BeginChangeCheck(); m_RoomIndex = EditorGUILayout.Popup(s_RoomText, m_RoomIndex, s_RoomStrings); if (EditorGUI.EndChangeCheck() && m_InPlayMode) { LoadCurrentRoom(); } EditorGUI.BeginChangeCheck(); m_Hand = (GestureHand)EditorGUILayout.Popup(s_HandText, (int)m_Hand, s_HandStrings); if (EditorGUI.EndChangeCheck()) { HolographicEmulation.SetGestureHand(m_Hand); } break; } }
private static void RequestGestureDuplication(GestureManager manager, GestureHand hand, int gestureIndex) { var fullGestureName = manager.GetFinalGestureName(hand, gestureIndex); var gestureName = "[" + fullGestureName.Substring(fullGestureName.IndexOf("]", StringComparison.Ordinal) + 2) + "]"; var newAnimation = GmgAnimationHelper.CloneAnimationAsset(manager.Module.GetFinalGestureByIndex(hand, gestureIndex)); var path = EditorUtility.SaveFilePanelInProject("Creating Gesture: " + fullGestureName, gestureName + ".anim", "anim", "Hi (?)"); if (path.Length == 0) { return; } AssetDatabase.CreateAsset(newAnimation, path); newAnimation = AssetDatabase.LoadAssetAtPath <AnimationClip>(path); manager.Module.AddGestureToOverrideController(gestureIndex, newAnimation); }
public void AddStartPoint(GestureHand hand, Vector3 startPos) { float tempRot; float h = Mathf.Sqrt(startPos.x * startPos.x + startPos.z * startPos.z); //Determine the rotation of this node relative to the head if (h == 0) { tempRot = 0; } else { if (startPos.x >= 0) { tempRot = Mathf.Acos(startPos.z / h); } else { tempRot = 2.0f * Mathf.PI - Mathf.Acos(startPos.z / h); } } //If this node is the first then it should be the starting position if (hand == GestureHand.LEFT && leftNodes.Count == 0) { leftNodes.Add(startPos); leftLastNodePos = startPos; leftRotation = tempRot; //Debug.Log("Starting left"); //Debug.Log("left rot = " + leftRotation); } else if (hand == GestureHand.RIGHT && rightNodes.Count == 0) { rightNodes.Add(startPos); rightLastNodePos = startPos; rightRotation = tempRot; //Debug.Log("Starting right"); //Debug.Log("right rot = " + rightRotation); } }
private void OnGUI() { if (!this.CheckOperatingSystem()) { EditorGUILayout.HelpBox("You must be running Windows build 14318 or later to use Holographic Simulation or Remoting.", MessageType.Warning); } else if (!this.IsWindowsMixedRealityCurrentTarget()) { EditorGUILayout.HelpBox("You must enable Virtual Reality support in settings and add Windows Mixed Reality to the devices to use Holographic Emulation.", MessageType.Warning); } else { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(this.m_InPlayMode); this.DrawRemotingMode(); EditorGUI.EndDisabledGroup(); EmulationMode mode = this.m_Mode; if (mode != EmulationMode.RemoteDevice) { if (mode == EmulationMode.Simulated) { EditorGUI.BeginChangeCheck(); this.m_RoomIndex = EditorGUILayout.Popup(HolographicEmulationWindow.s_RoomText, this.m_RoomIndex, HolographicEmulationWindow.s_RoomStrings, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck() && this.m_InPlayMode) { this.LoadCurrentRoom(); } EditorGUI.BeginChangeCheck(); this.m_Hand = (GestureHand)EditorGUILayout.Popup(HolographicEmulationWindow.s_HandText, (int)this.m_Hand, HolographicEmulationWindow.s_HandStrings, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { HolographicEmulation.SetGestureHand(this.m_Hand); } } } else { EditorGUI.BeginDisabledGroup(this.IsConnectedToRemoteDevice()); this.RemotingPreferencesOnGUI(); EditorGUI.EndDisabledGroup(); this.ConnectionStateGUI(); } } }
public float AverageDifference(Gesture toCompare, float lengthFactor, GestureHand hand) { float diff = 0; int numNodes = NumNodes(hand); for (int i = 1; i < numNodes; i++) { Vector3 node1 = NodeAt(i, hand); Vector3 node2 = toCompare.NodeAt(i, hand); float angleDifference = 1.0f - Vector3.Dot(node1.normalized, node2.normalized); float lengthDifference = Mathf.Abs(node1.magnitude - node2.magnitude) / node1.magnitude; diff += angleDifference + lengthDifference * lengthFactor; } return(diff / (numNodes - 1)); }
private void OnGUI() { if (!this.CheckOperatingSystem()) { EditorGUILayout.HelpBox("You must be running Windows build 14318 or later to use Holographic Simulation or Remoting.", MessageType.Warning); } else if (!this.IsHoloLensCurrentTarget()) { EditorGUILayout.HelpBox("You must enable Virtual Reality support in settings and add Windows Holographic to the devices to use Holographic Emulation.", MessageType.Warning); } else { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(this.m_InPlayMode); this.DrawRemotingMode(); EditorGUI.EndDisabledGroup(); switch (this.m_Mode) { case EmulationMode.RemoteDevice: EditorGUI.BeginDisabledGroup(this.m_ConnectionState != HolographicStreamerConnectionState.Disconnected); this.RemotingPreferencesOnGUI(); EditorGUI.EndDisabledGroup(); this.ConnectionStateGUI(); break; case EmulationMode.Simulated: EditorGUI.BeginChangeCheck(); this.m_RoomIndex = EditorGUILayout.Popup(s_RoomText, this.m_RoomIndex, s_RoomStrings, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck() && this.m_InPlayMode) { this.LoadCurrentRoom(); } EditorGUI.BeginChangeCheck(); this.m_Hand = (GestureHand)EditorGUILayout.Popup(s_HandText, (int)this.m_Hand, s_HandStrings, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { PerceptionSimulation.SetGestureHand(this.m_Hand); } break; } } }
public void SetNodeAt(int index, GestureHand hand, Vector3 value) { switch (hand) { case GestureHand.LEFT: if (leftNodes == null) { throw new System.Exception("This hand does not exist in this gesture"); } else if (index >= leftNodes.Count) { throw new System.Exception("Node index is too high. Count is " + leftNodes.Count + ", but index is " + index); } else { leftNodes[index] = value; } break; case GestureHand.RIGHT: if (rightNodes == null) { throw new System.Exception("This hand does not exist in this gesture"); } else if (index >= rightNodes.Count) { throw new System.Exception("Node index is too high. Count is " + rightNodes.Count + ", but index is " + index); } else { rightNodes[index] = value; } break; default: throw new System.Exception("Unable to get the node at more than one hand"); } }
public Gesture(GestureHand startingHand) { switch (startingHand) { case GestureHand.LEFT: leftNodes = new List <Vector3>(); rightNodes = null; break; case GestureHand.RIGHT: leftNodes = null; rightNodes = new List <Vector3>(); break; case GestureHand.BOTH: leftNodes = new List <Vector3>(); rightNodes = new List <Vector3>(); break; } curHands = startingHand; spell = SpellHandler.SpellType.NONE; }
public void AddNode(Vector3 node, GestureHand hand) { Vector3 offset; float theta; //Add a new node equal to the offset of the last node to this one and update the last node variable switch (hand) { case GestureHand.LEFT: if (leftLastNodePos != null) { offset = node - leftLastNodePos; leftLastNodePos = node; theta = leftRotation; } else { throw new System.Exception("The start point for this hand has not been added yet"); } break; case GestureHand.RIGHT: if (rightLastNodePos != null) { offset = node - rightLastNodePos; rightLastNodePos = node; theta = rightRotation; } else { throw new System.Exception("The start point for this hand has not been added yet"); } break; default: throw new System.Exception("You shouldn't be adding a node to both hands at once"); } //Rotate the offset as if the starting rotation of the gesture was zero float x = offset.x * Mathf.Cos(theta) - offset.z * Mathf.Sin(theta); float z = offset.x * Mathf.Sin(theta) + offset.z * Mathf.Cos(theta); offset.x = x; offset.z = z; //Debug.Log("x = " + x); //Debug.Log("z = " + z); //Add the offset to the gesture switch (hand) { case GestureHand.LEFT: if (leftNodes != null) { leftNodes.Add(offset); } else { throw new System.Exception("This hand does not exist in this gesture"); } break; case GestureHand.RIGHT: if (rightNodes != null) { rightNodes.Add(offset); } else { throw new System.Exception("This hand does not exist in this gesture"); } break; } }
internal static extern bool GetHandActivated(GestureHand hand);
private void OnGUI() { if (!this.CheckOperatingSystem()) { EditorGUILayout.HelpBox("You must be running Windows build 14318 or later to use Holographic Simulation or Remoting.", MessageType.Warning); } else if (!this.IsHoloLensCurrentTarget()) { EditorGUILayout.HelpBox("You must enable Virtual Reality support in settings and add Windows Holographic to the devices to use Holographic Emulation.", MessageType.Warning); } else { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(this.m_InPlayMode); this.DrawRemotingMode(); EditorGUI.EndDisabledGroup(); switch (this.m_Mode) { case EmulationMode.RemoteDevice: EditorGUI.BeginDisabledGroup(this.m_ConnectionState != HolographicStreamerConnectionState.Disconnected); this.RemotingPreferencesOnGUI(); EditorGUI.EndDisabledGroup(); this.ConnectionStateGUI(); break; case EmulationMode.Simulated: EditorGUI.BeginChangeCheck(); this.m_RoomIndex = EditorGUILayout.Popup(s_RoomText, this.m_RoomIndex, s_RoomStrings, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck() && this.m_InPlayMode) { this.LoadCurrentRoom(); } EditorGUI.BeginChangeCheck(); this.m_Hand = (GestureHand) EditorGUILayout.Popup(s_HandText, (int) this.m_Hand, s_HandStrings, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { PerceptionSimulation.SetGestureHand(this.m_Hand); } break; } } }
private static extern void INTERNAL_CALL_SetHandPosition_Internal(GestureHand hand, ref Vector3 position);
internal static extern void SetGestureHand_Internal(GestureHand hand);
extern internal static void SetGestureHand(GestureHand hand);
internal static void SetGestureHand(GestureHand hand) { HolographicEmulation.SetGestureHand_Internal(hand); }
// Require use of HolographicEmulation.simulatedLeftHand or HolographicEmulation.simulatedRightHand to get instance internal SimulatedHand(GestureHand hand) { m_Hand = hand; }
internal static extern void SetHandPosition(GestureHand hand, Vector3 position);
internal static void SetGestureHand(GestureHand hand) { SetGestureHand_Internal(hand); }
internal static extern Vector3 GetHandPosition(GestureHand hand);
internal static extern bool GetHandVisible(GestureHand hand);
internal static extern void PerformGesture(GestureHand hand, SimulatedGesture gesture);
internal static extern void SetHandActivated(GestureHand hand, bool activated);
public abstract AnimationClip GetFinalGestureByIndex(GestureHand hand, int gestureIndex);
internal static extern void EnsureHandVisible(GestureHand hand);
internal static void SetGestureHand(GestureHand hand) { PerceptionSimulation.SetGestureHand_Internal(hand); }