public bool TryGetHandJointPose(HandJointName jointName, out JointPose pose)
            {
                if (m_handJoints == null || !m_handJoints[jointName].isValid)
                {
                    pose = default(JointPose);
                    return(false);
                }

                pose = m_handJoints[jointName];
                return(true);
            }
Пример #2
0
        private void AssignHandJoint(RigidPose handPose, bool isLeft, JointEnumArray joints, HandJointName jointName, VRBoneTransform_t[] boneTransforms, int steamBoneIndex)
        {
            VRBoneTransform_t bone     = boneTransforms[steamBoneIndex];
            Vector3           position = new Vector3(-bone.position.v0, bone.position.v1, bone.position.v2);
            Quaternion        rotation = new Quaternion(bone.orientation.x, -bone.orientation.y, -bone.orientation.z, bone.orientation.w);

            if (steamBoneIndex == SteamVR_Skeleton_JointIndexes.wrist)
            {
                if (isLeft)
                {
                    rotation *= s_leftSkeletonWristFixRotation;
                }
                else
                {
                    rotation *= s_rightSkeletonWristFixRotation;
                }
            }
            else
            {
                if (isLeft)
                {
                    rotation *= s_leftSkeletonFixRotation;
                }
                else
                {
                    rotation *= s_rightSkeletonFixRotation;
                }
            }

            joints[jointName] = new JointPose(handPose * new RigidPose(position, rotation));
        }
Пример #3
0
 public static bool TryGetHandJointPose(uint deviceIndex, HandJointName jointName, out JointPose pose)
 {
     return(VRModule.GetCurrentDeviceState(deviceIndex).TryGetHandJointPose(jointName, out pose));
 }
Пример #4
0
 public static bool TryGetHandJointPoseEx(Type roleType, int roleValue, HandJointName jointName, out JointPose pose)
 {
     return(TryGetHandJointPose(ViveRole.GetDeviceIndexEx(roleType, roleValue), jointName, out pose));
 }
Пример #5
0
 public static bool TryGetHandJointPoseEx <TRole>(TRole role, HandJointName jointName, out JointPose pose)
 {
     return(TryGetHandJointPose(ViveRole.GetDeviceIndexEx(role), jointName, out pose));
 }
Пример #6
0
 public static bool TryGetHandJointPose(ViveRoleProperty role, HandJointName jointName, out JointPose pose)
 {
     return(TryGetHandJointPose(role.GetDeviceIndex(), jointName, out pose));
 }
        private void UpdateFingerJoints(JointEnumArray.IReadOnly roomSpaceJoints, Transform parentTransform, RigidPose roomSpaceParentPoseInverse, HandJointName startJoint, HandJointName endJoint)
        {
            foreach (var index in EnumArrayBase <HandJointName> .StaticEnumsFrom(startJoint, endJoint))
            {
                var jointTrans = m_modelJoints[index];
                if (jointTrans == null)
                {
                    continue;
                }

                var data = roomSpaceJoints[index];
                if (!data.isValid)
                {
                    continue;
                }

                var parentSpaceJointPose = roomSpaceParentPoseInverse * data.pose;
                UpdateJointTransformLocal(parentTransform, jointTrans, parentSpaceJointPose);
                parentTransform            = jointTrans;
                roomSpaceParentPoseInverse = data.pose.GetInverse();
            }
        }