Пример #1
0
        void Initialize()
        {
            var skeletonBuilder = new SkeletonBuilder(this.transform);

            skeletonBuilder.AddBasicSkeleton(new SkeletonBuilderParams());

            var leftHandRotation = Quaternion.Euler(0, 180, 180);

            skeletonBuilder.UpdateRotation(HumanBodyBones.LeftHand, leftHandRotation);

            var rightHandRotation = Quaternion.Euler(0, 0, 0);

            skeletonBuilder.UpdateRotation(HumanBodyBones.RightHand, rightHandRotation);

            AddHandSkeletonBones(skeletonBuilder, true);  // Left

            AddHandSkeletonBones(skeletonBuilder, false); // Right

            _Skeleton = skeletonBuilder.Skeleton;

            var avatar = AvatarBuilder.BuildHumanAvatar(this.gameObject, skeletonBuilder.GetHumanDescription());

            _SrcPoseHandler = new HumanPoseHandler(avatar, this.transform);

            if (_VisualizeBones && _XYZAxisPrefab != null)
            {
                foreach (var bone in skeletonBuilder.Skeleton.Values)
                {
                    GameObject axis = GameObject.Instantiate(_XYZAxisPrefab, Vector3.zero, Quaternion.identity, bone);
                    axis.transform.localScale    = new Vector3(_AxisObjectScale, _AxisObjectScale, _AxisObjectScale);
                    axis.transform.localPosition = Vector3.zero;
                    axis.transform.localRotation = Quaternion.identity;
                }
            }
        }