protected Quaternion[] GetBoneRotations() { if (skeletonAvailable) { Quaternion[] rawSkeleton = skeletonAction.GetBoneRotations(); if (mirroring == MirrorType.LeftToRight || mirroring == MirrorType.RightToLeft) { for (int boneIndex = 0; boneIndex < rawSkeleton.Length; boneIndex++) { rawSkeleton[boneIndex] = MirrorRotation(boneIndex, rawSkeleton[boneIndex]); } } return(rawSkeleton); } else { //fallback to getting skeleton pose from skeletonPoser if (fallbackPoser != null) { return(fallbackPoser.GetBlendedPose(skeletonAction, inputSource).boneRotations); } else { Debug.LogError("Skeleton Action is not bound, and you have not provided a fallback SkeletonPoser. Please create one to drive hand animation when no skeleton data is available.", this); return(null); } } }
protected void CopyBoneRotations(Quaternion[] rotationBuffer) { if (skeletonAvailable) { Quaternion[] rawSkeleton = skeletonAction.GetBoneRotations(); if (mirroring == MirrorType.LeftToRight || mirroring == MirrorType.RightToLeft) { for (int boneIndex = 0; boneIndex < rotationBuffer.Length; boneIndex++) { MirrorBoneRotation(ref rawSkeleton[boneIndex], ref rotationBuffer[boneIndex], boneIndex); } } else { rawSkeleton.CopyTo(rotationBuffer, 0); } } else { //fallback to getting skeleton pose from skeletonPoser if (fallbackPoser != null) { fallbackPoser.GetBlendedPose(skeletonAction, inputSource).boneRotations.CopyTo(rotationBuffer, 0); } else { Debug.LogError("Skeleton Action is not bound, and you have not provided a fallback SkeletonPoser. Please create one to drive hand animation when no skeleton data is available."); } } }
protected Quaternion[] GetBoneRotations(SteamVR_Input_Sources inputSource) { Quaternion[] rawSkeleton = skeletonAction.GetBoneRotations(inputSource); if (mirroring == MirrorType.LeftToRight || mirroring == MirrorType.RightToLeft) { for (int boneIndex = 0; boneIndex < rawSkeleton.Length; boneIndex++) { if (boneIndex == SteamVR_Skeleton_JointIndexes.wrist) { rawSkeleton[boneIndex].y = rawSkeleton[boneIndex].y * -1; rawSkeleton[boneIndex].z = rawSkeleton[boneIndex].z * -1; } if (IsMetacarpal(boneIndex)) { rawSkeleton[boneIndex] = rightFlipAngle * rawSkeleton[boneIndex]; } } } return(rawSkeleton); }