internal static int ManusGetData(GLOVE_HAND hand, ref GLOVE_DATA data, uint timeout = 0) { float[] AndroidData = Android.Call<float[]>("getData", (int)hand); if (AndroidData.Length != 15) return ERROR; data.Acceleration = new GLOVE_VECTOR(new List<float>(AndroidData).GetRange(0, 3).ToArray()); data.Euler = new GLOVE_VECTOR(new List<float>(AndroidData).GetRange(3, 3).ToArray()); data.Quaternion = new GLOVE_QUATERNION(new List<float>(AndroidData).GetRange(6, 4).ToArray()); data.Fingers = new List<float>(AndroidData).GetRange(10, 5).ToArray(); return SUCCESS; }
internal static extern int ManusSetHandedness(GLOVE_HAND hand, bool right_hand);
internal static extern int ManusGetSkeletal(GLOVE_HAND hand, ref GLOVE_SKELETAL model, uint timeout = 0);
/// <summary> /// Gets the transoform of a fingerPart. /// </summary> /// <param name="data">Glove data</param> /// <param name="finger">The finger you want</param> /// <param name="fingerPart">The fingerpart you want, for example the fingertop (Distal phalanges)</param> /// <param name="rootTransform">Transform of hand</param> /// <param name="hand">Which hand it is</param> /// <returns>The fingertop from the finger you want</returns> internal Transform GetFinger(GLOVE_DATA data, int finger, FingerPart fingerPart, ref Transform rootTransform, GLOVE_HAND hand) { int part = (int)fingerPart; return(FindDeepChild(rootTransform, "Finger_" + finger.ToString() + part.ToString())); }
internal static int ManusCalibrate(GLOVE_HAND hand, bool gyro = true, bool accel = true, bool fingers = false) { return Android.Call<int>("calibrate", (int)hand, gyro, accel, fingers); }
internal static int ManusSetHandedness(GLOVE_HAND hand, bool right_hand) { return Android.Call<int>("setHandedness", (int)hand, right_hand); }
internal static extern int ManusSetVibration(GLOVE_HAND hand, float power);
public static extern int ManusGetData(GLOVE_HAND hand, out GLOVE_DATA data, uint timeout = 0);
public static extern int ManusSetHandedness(GLOVE_HAND hand, GLOVE_HAND newHand);
public static extern int ManusGetSkeletal(GLOVE_HAND hand, out GLOVE_SKELETAL model, uint timeout = 1000);
/// <summary> /// Gets the transform of a fingertop. /// </summary> /// <param name="data">Glove data</param> /// <param name="finger">The finger you want</param> /// <param name="rootTransform">Transform of hand</param> /// <param name="hand">Which hand it is</param> /// <returns>The fingertop from the finger you want</returns> internal Transform GetFinger(GLOVE_DATA data, int finger, ref Transform rootTransform, GLOVE_HAND hand) { int j = 3; return(FindDeepChild(rootTransform, "Finger_" + finger.ToString() + j.ToString())); }
/// <summary> /// Updates a Finger in a hand model /// </summary> /// <param name="t">Root of the transform to be updated</param> /// <param name="finger">Finger number to be updated</param> /// <param name="quat">Manus Quaternion to be used</param> /// <param name="hand">Hand to be updates</param> private void GameObjectToSkeletal(ref Transform t, int finger, GLOVE_QUATERNION q, GLOVE_HAND hand) { if (null == t) { return; } t.localRotation = new Quaternion(-q.y, -q.z, q.x, q.w); for (int j = 0; j < 4; j++) { FindDeepChild(t, "Finger_" + finger.ToString() + j.ToString()).localRotation = FindDeepChild(gameObject.transform, "Finger_" + finger.ToString() + j.ToString()).localRotation; //Debug.Log(FindDeepChild(t, "Finger_" + finger.ToString() + j.ToString()).localRotation); //Debug.Log(FindDeepChild(gameObject.transform, "Finger_" + finger.ToString() + j.ToString()).localRotation); } }
internal static extern int ManusGetData(GLOVE_HAND hand, ref GLOVE_DATA data, uint timeout = 0);
internal static extern int ManusCalibrate(GLOVE_HAND hand, bool gyro = true, bool accel = true, bool fingers = false);
public static extern int ManusCalibrate(GLOVE_HAND hand, bool gyro = true, bool accel = true, bool fingers = false);
public static extern int ManusSetVibration(GLOVE_HAND hand, float power);
internal static int ManusSetVibration(GLOVE_HAND hand, float power) { return Android.Call<int>("setVibration", (int)hand, power); }
/// <summary> /// Constructor for Glove class /// </summary> /// <param name="gh">Left or right glove</param> public Glove(GLOVE_HAND gh) { center = Quaternion.identity; hand = gh; }
/// <summary> /// Constructor for Glove class /// </summary> /// <param name="gh">Left or right glove</param> public Glove(GLOVE_HAND gh) { hand = gh; }