KinectManager.GetUserOrientation C# (CSharp) Метод

GetUserOrientation() публичный Метод

public GetUserOrientation ( uint UserId, bool flip ) : Quaternion
UserId uint
flip bool
Результат Quaternion
    public Quaternion GetUserOrientation(uint UserId, bool flip)
    {
        KinectWrapper.GetJointTransformation(UserId, (int)KinectWrapper.SkeletonJoint.HIPS, ref jointTransform);
        KinectWrapper.SkeletonJointOrientation ori = jointTransform.ori;
        Quaternion quat = ConvertMatrixToQuat(ori, (int)KinectWrapper.SkeletonJoint.HIPS, flip);

        return quat;
    }

Usage Example

Пример #1
0
        // adds current pose of poseModel to the saved poses list
        private void AddCurrentPoseToSaved(float fCurrentTime, bool isMirrored)
        {
            KinectManager kinectManager = KinectManager.Instance;

            if (kinectManager == null || poseModel == null || poseJoints == null)
            {
                return;
            }

            PoseModelData pose = new PoseModelData();

            pose.fTime      = fCurrentTime;
            pose.avBoneDirs = new Vector3[poseJoints.Count];

            // save model rotation
            Quaternion poseModelRotation = poseModel.transform.rotation;

            if (avatarController)
            {
                ulong avatarUserId     = avatarController.playerId;
                bool  isAvatarMirrored = avatarController.mirroredMovement;

                Quaternion userRotation = kinectManager.GetUserOrientation(avatarUserId, !isAvatarMirrored);
                poseModel.transform.rotation = initialPoseRotation * userRotation;
            }

            int jointCount = kinectManager.GetJointCount();

            for (int i = 0; i < poseJoints.Count; i++)
            {
                KinectInterop.JointType joint     = poseJoints[i];
                KinectInterop.JointType nextJoint = kinectManager.GetNextJoint(joint);

                if (nextJoint != joint && (int)nextJoint >= 0 && (int)nextJoint < jointCount)
                {
                    Transform poseTransform1 = poseModel.GetBoneTransform(poseModel.GetBoneIndexByJoint(joint, isMirrored));
                    Transform poseTransform2 = poseModel.GetBoneTransform(poseModel.GetBoneIndexByJoint(nextJoint, isMirrored));

                    if (poseTransform1 != null && poseTransform2 != null)
                    {
                        pose.avBoneDirs[i] = (poseTransform2.position - poseTransform1.position).normalized;
                    }
                }
            }

            // add pose to the list
            alSavedPoses.Add(pose);

            // restore model rotation
            poseModel.transform.rotation = poseModelRotation;
        }
All Usage Examples Of KinectManager::GetUserOrientation