Ejemplo n.º 1
0
 /// <summary>
 /// Updates a skeletal from glove data
 /// </summary>
 /// <param name="data">The glove data to be used for the update</param>
 /// <param name="rootTransform">Root of the transform to be updated</param>
 /// <param name="hand">Hand to be updated</param>
 internal void Simulate(GLOVE_DATA data, ref Transform rootTransform, GLOVE_HAND hand)
 {
     for (int i = 0; i < 5; i++)
     {
         animationClip.SampleAnimation(gameObject, data.Fingers[i] * timeFactor);
         GameObjectToSkeletal(ref rootTransform, i, data.Quaternion, hand);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves the current Skeletal from the glove and
        /// converts is from Manus to Unity format.
        /// </summary>
        /// <param name="unitySkel">Skeletal from Unity, which is to be updated.</param>
        public void UpdateTransform(ref Transform rootTransform)
        {
            GLOVE_DATA data = new GLOVE_DATA();

            if (Manus.SUCCESS == Manus.ManusGetData(hand, ref data))
            {
                hs.Simulate(data, ref rootTransform, hand);
            }
        }
Ejemplo n.º 3
0
        public Transform GetFingerObject(ref Transform rootTransform, int finger)
        {
            GLOVE_DATA data = new GLOVE_DATA();

            if (Manus.SUCCESS == Manus.ManusGetData(hand, ref data))
            {
                return(hs.GetFinger(data, finger, ref rootTransform, hand));
            }
            return(null);
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public static extern int ManusGetData(GLOVE_HAND hand, out GLOVE_DATA data, uint timeout = 0);
Ejemplo n.º 7
0
 internal static extern int ManusGetData(GLOVE_HAND hand, ref GLOVE_DATA data, uint timeout = 0);
Ejemplo n.º 8
0
 internal static extern int ManusGetData(GLOVE_HAND hand, ref GLOVE_DATA data, uint timeout = 0);
Ejemplo n.º 9
0
 public static extern int ManusGetData(GLOVE_HAND hand, out GLOVE_DATA data, uint timeout = 0);
Ejemplo n.º 10
0
        /// <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()));
        }
Ejemplo n.º 11
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()));
        }