public bool JointOnScreen(JointIndex jointIndex)
 {
     if (hand != null && hand.IsDetected())
     {
         return(stereoCamera || OnScreen(hand.GetJointPosition(jointIndex)));
     }
     return(false);
 }
        public ActionResult Index()
        {
            JointIndex ji = new JointIndex();

            ji.favorites   = db.favorites.ToList();
            ji.mytables    = db.mytables.ToList();
            ji.ratings     = db.Ratings.ToList();
            ViewBag.userID = User.Identity.GetUserId();

            return(View(ji));
        }
Example #3
0
    private void AddSkeleton(JointIndex s, JointIndex e)
    {
        var sk = new Skeleton()
        {
            LineObject = new GameObject("Line"),
            start      = jointPoints[(int)s],
            end        = jointPoints[(int)e],
        };

        sk.Line            = sk.LineObject.AddComponent <LineRenderer>();
        sk.Line.startWidth = 0.04f;
        sk.Line.endWidth   = 0.01f;

        // define the number of vertex
        sk.Line.positionCount = 2;
        sk.Line.material      = SkeletonMaterial;

        Skeletons.Add(sk);
    }
        void setPalmBones()
        {
            // These joints are palm and fingers' root joints.
            JointIndex[] jointIndex = new JointIndex[6] {
                JointIndex.WristJoint,
                JointIndex.ThumbProximal,
                JointIndex.IndexProximal,
                JointIndex.MiddleProximal,
                JointIndex.RingProximal,
                JointIndex.PinkyProximal
            };

            for (int i = 0; i < jointIndex.Length; ++i)
            {
                Vector3 startJointPos = hand.GetJointPosition(jointIndex[i]);
                Vector3 endJointPos   = hand.GetJointPosition(jointIndex[(i + 1) % 6]);

                Vector3 startPoint = transform.TransformPoint((startJointPos - hand.GetWristPosition())
                                                              / moveScale * renderScale + hand.GetWristPosition());
                Vector3 endPoint = transform.TransformPoint((endJointPos - hand.GetWristPosition())
                                                            / moveScale * renderScale + hand.GetWristPosition());

                float dis = Vector3.Distance(startJointPos, endJointPos);

                Vector3 dir = endJointPos - startJointPos;
                dir = Camera.main.transform.TransformDirection(dir);

                // scale
                bones[fingerTipBonesNum * i].localScale = new Vector3(
                    0.01f * bonePrefabScale.x / moveScale * renderScale,
                    dis * .5f * bonePrefabScale.y,
                    0.01f * bonePrefabScale.z / moveScale * renderScale);
                // position
                bones[fingerTipBonesNum * i].position = (startPoint + endPoint) * .5f;
                // rotation
                bones[fingerTipBonesNum * i].rotation = Quaternion.LookRotation(hand.GetPalmNormal(), dir);
                // visibility
                bones[fingerTipBonesNum * i].GetComponent <Renderer>().enabled = isVisible;
            }
        }
Example #5
0
            public override void SetData(byte[] data)
            {
                if ((data.Length % ENTRY_SIZE) != 0)
                {
                    throw new Z64ObjectException($"Invalid data size (0x{data.Length:X}) should be a multiple of 6");
                }

                JointIndices = new JointIndex[data.Length / ENTRY_SIZE];
                using (MemoryStream ms = new MemoryStream(data))
                {
                    BinaryStream br = new BinaryStream(ms, ByteConverter.Big);

                    for (int i = 0; i < JointIndices.Length; i++)
                    {
                        JointIndices[i] = new JointIndex()
                        {
                            X = br.ReadUInt16(),
                            Y = br.ReadUInt16(),
                            Z = br.ReadUInt16()
                        }
                    }
                    ;
                }
            }