/// <summary> /// Feed the HandDataManager with the apollo hand data, this will only work if the stream type is set to custom. /// </summary> /// <param name="apolloHandData">The new apollo hand data.</param> /// <param name="side">The side for which this data applies.</param> public static void FeedCustomStreamHandData(ApolloHandData apolloHandData, GloveLaterality side) { if (OnNewCustomStreamHandData != null) { OnNewCustomStreamHandData(apolloHandData, side); } }
/// <summary> /// Animate this hand using the given hand data. /// </summary> /// <param name="handData">The hand data that should be used to animate the hand.</param> public virtual void AnimateHand(ApolloHandData handData) { RotateWrist(handData.processedWristImu); const int thumb = (int)ApolloHandData.FingerName.Thumb; const int CMC = (int)ApolloHandData.JointNameThumb.CMC; RotateThumb(handData.fingers[thumb].joints[CMC]); RotateFingers(handData); }
private static void NewCustomData(ApolloHandData apolloHandData, GloveLaterality side) { //Log("Received new hand data for a " + side + " glove with device ID " + apolloHandData.deviceID + "."); // Get ready to store the new data. int playerIndex = -1; device_type_t deviceType = device_type_t.GLOVE_LEFT; if (!PrepareForNewData(true, side, apolloHandData.deviceID, out playerIndex, out deviceType)) { // Failed to prepare for the new data. The new data cannot be stored. // Printing a log message is done in the function, so don't print anything here. return; } // Set the data. playerData[playerIndex].handData[deviceType] = apolloHandData; }
protected virtual void RotateFingers(ApolloHandData handData) { for (int fingerNum = 0; fingerNum < FingerControllers.Count; fingerNum++) // Go over all fingerData, including the thumb. { for (int jointNum = 1; jointNum <= 3; jointNum++) // CMC to IP for the thumb, MCP to DIP for the other fingerData. { ApolloHandData.FingerName convertedFingerNum = (ApolloHandData.FingerName)fingerNum; try { FingerControllers[convertedFingerNum].RotatePhalange(jointNum, handData.fingers[fingerNum].joints[jointNum]); } catch (NullReferenceException) { Debug.LogError($"FingerControllers not found {convertedFingerNum} / {jointNum} / {fingerNum}"); } } } }
public virtual void UpdateHand(ApolloHandData handData) { handData.UpdateGrabState(); }