public override Quaternion QuatHead(Rot4 rotation)
        {
            float      num    = 1f;
            Quaternion asQuat = rotation.AsQuat;
            float      x      =
                1f * Mathf.Sin(num * (this.CompFace.HeadRotator.CurrentMovement * 0.1f) % (2 * Mathf.PI));
            float z =
                1f * Mathf.Cos(num * (this.CompFace.HeadRotator.CurrentMovement * 0.1f) % (2 * Mathf.PI));

            asQuat.SetLookRotation(new Vector3(x, 0f, z), Vector3.up);
            return(asQuat);

            // remove the body rotation
            CompBodyAnimator animator = this.CompAnimator;

            if (animator != null && (animator.IsMoving && Controller.settings.UseFeet))
            {
                WalkCycleDef walkCycle = this.CompAnimator?.WalkCycle;
                if (this.BodyFacing.IsHorizontal)
                {
                    asQuat *= Quaternion.AngleAxis(
                        (this.BodyFacing == Rot4.West ? 1 : -1)
                        * walkCycle?.BodyAngle.Evaluate(this.CompAnimator.MovedPercent) ?? 0f,
                        Vector3.up);
                }

                asQuat *= Quaternion.AngleAxis(
                    (this.BodyFacing == Rot4.South ? 1 : -1)
                    * walkCycle?.BodyAngleVertical
                    .Evaluate(this.CompAnimator.MovedPercent) ?? 0f,
                    Vector3.up);
            }

            return(asQuat);
        }
Пример #2
0
        protected override void SetCurrentCycle()
        {
            BodyAnimDef anim = this.CompAnim.BodyAnim;

            if (anim != null && anim.walkCycles.Any())
            {
                EditorWalkcycle =
                    anim.walkCycles.FirstOrDefault().Value;
            }
        }
Пример #3
0
        protected override void FindRandomPawn()
        {
            if (Pawn == null)
            {
                base.FindRandomPawn();

                BodyAnimDef anim = this.CompAnim.BodyAnim;
                if (anim != null && anim.walkCycles.Any())
                {
                    EditorWalkcycle = anim.walkCycles.FirstOrDefault().Value;
                }
            }
        }
Пример #4
0
        public override void ApplyBodyWobble(ref Vector3 rootLoc, ref Vector3 footPos, ref Quaternion quat)
        {
            if (this.CompAnimator.IsMoving)
            {
                WalkCycleDef walkCycle = this.CompAnimator.WalkCycle;
                if (walkCycle != null)
                {
                    float bam = this.CompAnimator.BodyOffsetZ;

                    rootLoc.z += bam;
                    quat = this.QuatBody(quat, this.CompAnimator.MovedPercent);

                    // Log.Message(CompFace.Pawn + " - " + this.movedPercent + " - " + bam.ToString());
                }
            }

            // Adds the leg length to the rootloc and relocates the feet to keep the pawn in center, e.g. for shields
            if (this.CompAnimator.BodyAnim != null)
            {
                float legModifier = this.CompAnimator.BodyAnim.extraLegLength;
                float posModB = legModifier * 0.75f;
                float posModF = -legModifier * 0.25f;
                Vector3 vector3 = new Vector3(0, 0, posModB);
                Vector3 vector4 = new Vector3(0, 0, posModF);

                // No rotation when moving
                if (!this.CompAnimator.IsMoving)
                {
                    vector3 = quat * vector3;
                    vector4 = quat * vector4;
                }
                if (!this.CompAnimator.IsRider)
                {
                    rootLoc += vector3;
                }
                else
                {
                    footPos -= vector3;
                }
                footPos += vector4;

            }

            base.ApplyBodyWobble(ref rootLoc, ref footPos, ref quat);
        }
Пример #5
0
        public Quaternion QuatBody(Quaternion quat, float movedPercent)
        {
            WalkCycleDef walkCycle = this.CompAnimator.WalkCycle;
            if (walkCycle != null)
            {
                float angle;
                if (this.BodyFacing.IsHorizontal)
                {
                    angle = (this.BodyFacing == Rot4.West ? -1 : 1)
                          * walkCycle.BodyAngle.Evaluate(movedPercent);
                }
                else
                {
                    angle = (this.BodyFacing == Rot4.South ? -1 : 1)
                          * walkCycle.BodyAngleVertical.Evaluate(movedPercent);
                }

                quat *= Quaternion.AngleAxis(angle, Vector3.up);
                this.CompAnimator.BodyAngle = angle;
            }

            return quat;
        }
Пример #6
0
        public void ApplyEquipmentWobble(ref Vector3 rootLoc)
        {
            if (this.CompAnimator.IsMoving)
            {
                WalkCycleDef walkCycle = this.CompAnimator.WalkCycle;
                if (walkCycle != null)
                {
                    float bam = this.CompAnimator.BodyOffsetZ;
                    rootLoc.z += bam;

                    // Log.Message(CompFace.Pawn + " - " + this.movedPercent + " - " + bam.ToString());
                }
            }

            // Adds the leg length to the rootloc and relocates the feet to keep the pawn in center, e.g. for shields
            if (this.CompAnimator.BodyAnim != null)
            {
                float   legModifier = this.CompAnimator.BodyAnim.extraLegLength;
                float   posModB     = legModifier * 0.85f;
                Vector3 vector3     = new Vector3(0, 0, posModB);

                rootLoc += vector3;
            }
        }
Пример #7
0
        protected override void DrawKeyframeEditor(Rect keyframes, Rot4 rotation)
        {
            if (this.CurrentFrame == null)
            {
                return;
            }

            Rect leftController  = keyframes.LeftHalf();
            Rect rightController = keyframes.RightHalf();

            leftController.xMax -= this.Spacing;

            rightController.xMin += this.Spacing;
            {
                GUI.BeginGroup(leftController);
                Rect editorRect = new Rect(0f, 0f, leftController.width, 56f);

                // Dictionary<int, float> keysFloats = new Dictionary<int, float>();

                // // Get the next keyframe
                // for (int i = 0; i < frames.Count; i++)
                // {
                // float? footPositionX = frames[i].FootPositionX;
                // if (!footPositionX.HasValue)
                // {
                // continue;
                // }
                // keysFloats.Add(frames[i].KeyIndex, footPositionX.Value);
                // }
                List <int>          framesAt;
                List <PawnKeyframe> frames    = PawnKeyframes;
                WalkCycleDef        walkcycle = EditorWalkcycle;
                {
                    framesAt = (from keyframe in frames where keyframe.FootPositionX.HasValue select keyframe.KeyIndex)
                               .ToList();

                    this.SetPosition(
                        ref this.CurrentFrame.FootPositionX,
                        ref editorRect,
                        walkcycle.FootPositionX,
                        "FootPosX",
                        framesAt);

                    framesAt = (from keyframe in frames where keyframe.FootPositionZ.HasValue select keyframe.KeyIndex)
                               .ToList();

                    this.SetPosition(
                        ref this.CurrentFrame.FootPositionZ,
                        ref editorRect,
                        walkcycle.FootPositionZ,
                        "FootPosY",
                        framesAt);

                    framesAt = (from keyframe in frames where keyframe.FootAngle.HasValue select keyframe.KeyIndex)
                               .ToList();

                    this.SetAngle(
                        ref this.CurrentFrame.FootAngle,
                        ref editorRect,
                        walkcycle.FootAngle,
                        "FootAngle",
                        framesAt);

                    framesAt = (from keyframe in frames
                                where keyframe.HipOffsetHorizontalX.HasValue
                                select keyframe.KeyIndex).ToList();

                    this.SetPosition(
                        ref this.CurrentFrame.HipOffsetHorizontalX,
                        ref editorRect,
                        walkcycle.HipOffsetHorizontalX,
                        "HipOffsetHorizontalX",
                        framesAt);

                    // Quadruped
                }

                // else
                // {
                // framesAt = (from keyframe in frames
                // where keyframe.FootPositionVerticalZ.HasValue
                // select keyframe.KeyIndex).ToList();
                // this.SetPosition(
                // ref thisFrame.FootPositionVerticalZ,
                // ref editorRect,
                // EditorWalkcycle.FootPositionVerticalZ,
                // "FootPosVerticalY", framesAt);
                // }
                GUI.EndGroup();

                GUI.BeginGroup(rightController);

                editorRect.x = 0f;
                editorRect.y = 0f;

                if (this.CompAnim.Props.bipedWithHands)
                {
                    this.SetAngleShoulder(ref walkcycle.shoulderAngle, ref editorRect, "ShoulderAngle");

                    framesAt =
                        (from keyframe in frames where keyframe.HandsSwingAngle.HasValue select keyframe.KeyIndex)
                        .ToList();

                    this.SetAngle(
                        ref this.CurrentFrame.HandsSwingAngle,
                        ref editorRect,
                        walkcycle.HandsSwingAngle,
                        "HandSwing",
                        framesAt);
                }

                if (rotation.IsHorizontal)
                {
                    if (this.CompAnim.Props.quadruped)
                    {
                        framesAt = (from keyframe in frames
                                    where keyframe.FrontPawPositionX.HasValue
                                    select keyframe.KeyIndex).ToList();
                        this.SetPosition(
                            ref this.CurrentFrame.FrontPawPositionX,
                            ref editorRect,
                            walkcycle.FrontPawPositionX,
                            "FrontPawPositionX",
                            framesAt);

                        framesAt = (from keyframe in frames
                                    where keyframe.FrontPawPositionZ.HasValue
                                    select keyframe.KeyIndex).ToList();

                        this.SetPosition(
                            ref this.CurrentFrame.FrontPawPositionZ,
                            ref editorRect,
                            walkcycle.FrontPawPositionZ,
                            "FrontPawPositionZ",
                            framesAt);

                        framesAt = (from keyframe in frames
                                    where keyframe.FrontPawAngle.HasValue
                                    select keyframe.KeyIndex).ToList();

                        this.SetAngle(
                            ref this.CurrentFrame.FrontPawAngle,
                            ref editorRect,
                            walkcycle.FrontPawAngle,
                            "FrontPawAngle",
                            framesAt);
                    }

                    framesAt = (from keyframe in frames where keyframe.BodyAngle.HasValue select keyframe.KeyIndex)
                               .ToList();

                    this.SetAngle(
                        ref this.CurrentFrame.BodyAngle,
                        ref editorRect,
                        walkcycle.BodyAngle,
                        "BodyAngle",
                        framesAt);
                }
                else
                {
                    if (this.CompAnim.Props.bipedWithHands)
                    {
                        // framesAt = (from keyframe in frames
                        // where keyframe.HandsSwingPosVertical.HasValue
                        // select keyframe.KeyIndex).ToList();
                        // this.SetPosition(
                        // ref thisFrame.HandsSwingPosVertical,
                        // ref editorRect,
                        // EditorWalkcycle.HandsSwingPosVertical,
                        // "HandsSwingPosVertical", framesAt);
                    }

                    // framesAt = (from keyframe in frames
                    // where keyframe.FrontPawPositionVerticalZ.HasValue
                    // select keyframe.KeyIndex).ToList();
                    // if (this.CompAnim.Props.quadruped)
                    // {
                    // this.SetPosition(
                    // ref thisFrame.FrontPawPositionVerticalZ,
                    // ref editorRect,
                    // EditorWalkcycle.FrontPawPositionVerticalZ,
                    // "FrontPawPosVerticalY", framesAt);
                    // }
                    // framesAt = (from keyframe in frames
                    // where keyframe.BodyOffsetVerticalZ.HasValue
                    // select keyframe.KeyIndex).ToList();
                    // this.SetPosition(
                    // ref thisFrame.BodyOffsetVerticalZ,
                    // ref editorRect,
                    // EditorWalkcycle.BodyOffsetVerticalZ,
                    // "BodyOffsetVerticalZ", framesAt);
                    framesAt = (from keyframe in frames
                                where keyframe.BodyAngleVertical.HasValue
                                select keyframe.KeyIndex).ToList();
                    this.SetAngle(
                        ref this.CurrentFrame.BodyAngleVertical,
                        ref editorRect,
                        walkcycle.BodyAngleVertical,
                        "BodyAngleVertical",
                        framesAt);
                }
                framesAt = (from keyframe in frames
                            where keyframe.ShoulderOffsetHorizontalX.HasValue
                            select keyframe.KeyIndex).ToList();
                this.SetPosition(
                    ref this.CurrentFrame.ShoulderOffsetHorizontalX,
                    ref editorRect,
                    walkcycle.ShoulderOffsetHorizontalX,
                    "ShoulderOffsetHorizontalX",
                    framesAt);
                framesAt =
                    (from keyframe in frames where keyframe.BodyOffsetZ.HasValue select keyframe.KeyIndex).ToList();

                this.SetPosition(
                    ref this.CurrentFrame.BodyOffsetZ,
                    ref editorRect,
                    walkcycle.BodyOffsetZ,
                    "BodyOffsetZ",
                    framesAt);

                GUI.EndGroup();
            }
        }
Пример #8
0
        // public static float horHeadOffset;
        protected override void DoBasicSettingsMenu(Listing_Standard listing)
        {
            base.DoBasicSettingsMenu(listing);

            //  listing.CheckboxLabeled("Moving", ref IsMoving);

            // listing_Standard.CheckboxLabeled("Equipment", ref Equipment);

            // listing_Standard.Label(horHeadOffset.ToString("N2") + " - " + verHeadOffset.ToString("N2"));
            // horHeadOffset = listing_Standard.Slider(horHeadOffset, -1f, 1f);
            // verHeadOffset = listing_Standard.Slider(verHeadOffset, -1f, 1f);
            listing.Label(this.BodyAnimDef.offCenterX.ToString("N2"));
            this.BodyAnimDef.offCenterX = listing.Slider(this.BodyAnimDef.offCenterX, -0.2f, 0.2f);

            if (listing.ButtonText(EditorWalkcycle.LabelCap))
            {
                List <string>          exists = new List <string>();
                List <FloatMenuOption> list   = new List <FloatMenuOption>();
                this.BodyAnimDef.walkCycles.Clear();

                foreach (WalkCycleDef walkcycle in (from bsm in DefDatabase <WalkCycleDef> .AllDefs
                                                    orderby bsm.LabelCap
                                                    select bsm)
                         .TakeWhile(current => this.BodyAnimDef.WalkCycleType != "None")
                         .Where(current => current.WalkCycleType ==
                                this.BodyAnimDef.WalkCycleType))
                {
                    list.Add(new FloatMenuOption(walkcycle.LabelCap, delegate { EditorWalkcycle = walkcycle; }));
                    exists.Add(walkcycle.locomotionUrgency.ToString());
                    this.BodyAnimDef.walkCycles.Add(walkcycle.locomotionUrgency, walkcycle);
                }

                string[] names = Enum.GetNames(typeof(LocomotionUrgency));
                for (int index = 0; index < names.Length; index++)
                {
                    string            name   = names[index];
                    LocomotionUrgency myenum = (LocomotionUrgency)Enum.ToObject(typeof(LocomotionUrgency), index);

                    if (exists.Contains(myenum.ToString()))
                    {
                        continue;
                    }

                    list.Add(
                        new FloatMenuOption(
                            "Add new " + this.BodyAnimDef.WalkCycleType + "_" + myenum,
                            delegate
                    {
                        WalkCycleDef newCycle = new WalkCycleDef();
                        newCycle.defName      =
                            newCycle.label    =
                                this.BodyAnimDef.WalkCycleType + "_" + name;
                        newCycle.locomotionUrgency = myenum;
                        newCycle.WalkCycleType     = this.BodyAnimDef.WalkCycleType;
                        GameComponent_FacialStuff.BuildWalkCycles(newCycle);
                        EditorWalkcycle = newCycle;

                        this.BodyAnimDef.walkCycles.Add(myenum, newCycle);
                    }));
                }

                Find.WindowStack.Add(new FloatMenu(list));
            }

            if (listing.ButtonText("This pawn is using: " + this.BodyAnimDef.WalkCycleType))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();

                List <WalkCycleDef> listy = DefDatabase <WalkCycleDef> .AllDefsListForReading;

                List <string> stringsy = new List <string>();

                foreach (WalkCycleDef cycleDef in listy)
                {
                    if (!stringsy.Contains(cycleDef.WalkCycleType))
                    {
                        stringsy.Add(cycleDef.WalkCycleType);
                    }
                }

                foreach (string s in stringsy)
                {
                    list.Add(new FloatMenuOption(s, delegate { this.BodyAnimDef.WalkCycleType = s; }));
                }

                Find.WindowStack.Add(new FloatMenu(list));
            }

            listing.Gap();
            string configFolder = DefPath;

            if (listing.ButtonText("Export BodyDef"))
            {
                string filePath = configFolder + "/BodyAnimDefs/" + this.BodyAnimDef.defName + ".xml";

                Find.WindowStack.Add(
                    Dialog_MessageBox.CreateConfirmation(
                        "Confirm overwriting " +
                        filePath,
                        delegate
                {
                    ExportAnimDefs.Defs animDef =
                        new ExportAnimDefs.Defs(this.BodyAnimDef);

                    DirectXmlSaver.SaveDataObject(
                        animDef,
                        filePath);
                },
                        true));

                // BodyAnimDef animDef = this.bodyAnimDef;
            }

            if (listing.ButtonText("Export WalkCycle"))
            {
                string path = configFolder + "/WalkCycleDefs/" + EditorWalkcycle.defName + ".xml";

                Find.WindowStack.Add(
                    Dialog_MessageBox.CreateConfirmation(
                        "Confirm overwriting " + path,
                        delegate
                {
                    ExportWalkCycleDefs.Defs cycle =
                        new ExportWalkCycleDefs.Defs(EditorWalkcycle);

                    DirectXmlSaver.SaveDataObject(
                        cycle,
                        path);
                },
                        true));
            }
        }
Пример #9
0
        private void DoWalkCycleOffsets(
            float armLength,
            ref Vector3 rightHand,
            ref Vector3 leftHand,
            ref List <float> shoulderAngle,
            ref List <float> handSwingAngle,
            ref JointLister shoulderPos,
            bool carrying,
            SimpleCurve cycleHandsSwingAngle,
            float offsetJoint)
        {
            // Has the pawn something in his hands?
            if (carrying)
            {
                return;
            }

            Rot4 rot = this.BodyFacing;

            // Basic values if pawn is carrying stuff
            float x  = 0;
            float x2 = -x;
            float y  = Offsets.YOffset_Behind;
            float y2 = y;
            float z;
            float z2;

            // Offsets for hands from the pawn center
            z = z2 = -armLength;

            if (rot.IsHorizontal)
            {
                x = x2 = 0f;
                if (rot == Rot4.East)
                {
                    y2 = -0.5f;
                }
                else
                {
                    y = -0.05f;
                }
            }
            else if (rot == Rot4.North)
            {
                y   = y2 = -0.02f;
                x  *= -1;
                x2 *= -1;
            }

            // Swing the hands, try complete the cycle
            if (this.CompAnimator.IsMoving)
            {
                WalkCycleDef walkCycle = this.CompAnimator.WalkCycle;
                float        percent   = this.CompAnimator.MovedPercent;
                if (rot.IsHorizontal)
                {
                    float lookie = rot == Rot4.West ? -1f : 1f;
                    float f      = lookie * offsetJoint;

                    shoulderAngle[0] = shoulderAngle[1] = lookie * walkCycle?.shoulderAngle ?? 0f;

                    shoulderPos.RightJoint.x += f;
                    shoulderPos.LeftJoint.x  += f;

                    handSwingAngle[0] = handSwingAngle[1] =
                        (rot == Rot4.West ? -1 : 1) * cycleHandsSwingAngle.Evaluate(percent);
                }
                else
                {
                    z  += cycleHandsSwingAngle.Evaluate(percent) / 500;
                    z2 -= cycleHandsSwingAngle.Evaluate(percent) / 500;

                    z  += walkCycle?.shoulderAngle / 800 ?? 0f;
                    z2 += walkCycle?.shoulderAngle / 800 ?? 0f;
                }
            }

            if (MainTabWindow_BaseAnimator.Panic || this.Pawn.Fleeing() || this.Pawn.IsBurning())
            {
                float offset = 1f + armLength;
                x  *= offset;
                z  *= offset;
                x2 *= offset;
                z2 *= offset;
                handSwingAngle[0] += 180f;
                handSwingAngle[1] += 180f;
                shoulderAngle[0]   = shoulderAngle[1] = 0f;
            }

            rightHand = new Vector3(x, y, z);
            leftHand  = new Vector3(x2, y2, z2);
        }
Пример #10
0
        public override void DrawHands(Quaternion bodyQuat, Vector3 drawPos,
                                       bool portrait,
                                       Thing carriedThing = null, bool flip = false)
        {
            if (this.Pawn.Dead || this.Pawn.Downed)
            {
                return;
            }

            if (portrait && !HarmonyPatchesFS.AnimatorIsOpen())
            {
                return;
            }

            if (!this.CompAnimator.Props.bipedWithHands)
            {
                return;
            }

            // return if hands already drawn on carrything
            bool carrying = carriedThing != null;

            if (this.CarryStuff() && !carrying)
            {
                return;
            }


            if (carrying)
            {
                this.ApplyEquipmentWobble(ref drawPos);
                carriedThing.DrawAt(drawPos, flip);
            }

            BodyAnimDef body = this.CompAnimator.BodyAnim;

            Rot4 rot = this.BodyFacing;

            if (body == null)
            {
                return;
            }

            JointLister shoulperPos = this.GetJointPositions(JointType.Shoulder,
                                                             body.shoulderOffsets[rot.AsInt],
                                                             body.shoulderOffsets[Rot4.North.AsInt].x,
                                                             carrying, this.Pawn.ShowWeaponOpenly());

            List <float> handSwingAngle = new List <float> {
                0f, 0f
            };
            List <float> shoulderAngle = new List <float> {
                0f, 0f
            };
            Vector3      rightHand = Vector3.zero;
            Vector3      leftHand  = Vector3.zero;
            WalkCycleDef walkCycle = this.CompAnimator.WalkCycle;
            PoseCycleDef poseCycle = this.CompAnimator.PoseCycle;

            if (walkCycle != null)
            {
                float offsetJoint = walkCycle.ShoulderOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent);

                this.DoWalkCycleOffsets(
                    body.armLength,
                    ref rightHand,
                    ref leftHand,
                    ref shoulderAngle,
                    ref handSwingAngle,
                    ref shoulperPos,
                    carrying,
                    walkCycle.HandsSwingAngle,
                    offsetJoint);
            }

            if (poseCycle != null)
            {
                this.DoPoseCycleOffsets(ref rightHand,
                                        ref shoulderAngle,
                                        ref handSwingAngle, poseCycle);
            }

            this.DoAttackAnimationHandOffsets(ref handSwingAngle, ref rightHand, false);

            this.GetBipedMesh(out Mesh handMeshRight, out Mesh handMeshLeft);

            Material matLeft  = this.LeftHandMat;
            Material matRight = this.RightHandMat;

            if (MainTabWindow_BaseAnimator.Colored)
            {
                matLeft  = this.CompAnimator.PawnBodyGraphic?.HandGraphicLeftCol?.MatSingle;
                matRight = this.CompAnimator.PawnBodyGraphic?.HandGraphicRightCol?.MatSingle;
            }
            else if (carriedThing == null)
            {
                switch (rot.AsInt)
                {
                case 1:
                    matLeft = this.LeftHandShadowMat;
                    break;

                case 3:
                    matRight = this.RightHandShadowMat;
                    break;
                }
            }

            bool drawLeft  = matLeft != null && this.CompAnimator.BodyStat.HandLeft != PartStatus.Missing;
            bool drawRight = matRight != null && this.CompAnimator.BodyStat.HandRight != PartStatus.Missing;

            if (drawLeft)
            {
                Quaternion quat;
                Vector3    position;
                bool       noTween = false;
                if (!this.CompAnimator.IsMoving && this.CompAnimator.HasLeftHandPosition)
                {
                    position = this.CompAnimator.SecondHandPosition;
                    quat     = this.CompAnimator.WeaponQuat;
                    noTween  = true;
                }
                else
                {
                    shoulperPos.LeftJoint = bodyQuat * shoulperPos.LeftJoint;
                    leftHand = bodyQuat * leftHand.RotatedBy(-handSwingAngle[0] - shoulderAngle[0]);

                    position = drawPos + shoulperPos.LeftJoint + leftHand;
                    quat     = bodyQuat * Quaternion.AngleAxis(-handSwingAngle[0], Vector3.up);
                }

                TweenThing handLeft = TweenThing.HandLeft;
                this.DrawTweenedHand(position, handMeshLeft, matLeft, quat, handLeft, portrait, noTween);
                //GenDraw.DrawMeshNowOrLater(
                //                           handMeshLeft, position,
                //                           quat,
                //                           matLeft,
                //                           portrait);
            }

            if (drawRight)
            {
                Quaternion quat;
                Vector3    position;
                bool       noTween = false;
                if (this.CompAnimator.FirstHandPosition != Vector3.zero)
                {
                    quat     = this.CompAnimator.WeaponQuat;
                    position = this.CompAnimator.FirstHandPosition;
                    noTween  = true;
                }
                else
                {
                    shoulperPos.RightJoint = bodyQuat * shoulperPos.RightJoint;
                    rightHand =
                        bodyQuat * rightHand.RotatedBy(handSwingAngle[1] - shoulderAngle[1]);

                    position = drawPos + shoulperPos.RightJoint + rightHand;
                    quat     = bodyQuat * Quaternion.AngleAxis(handSwingAngle[1], Vector3.up);
                }

                TweenThing handRight = TweenThing.HandRight;
                this.DrawTweenedHand(position, handMeshRight, matRight, quat, handRight, portrait, noTween);
                // GenDraw.DrawMeshNowOrLater(
                //                            handMeshRight, position,
                //                            quat,
                //                            matRight,
                //                            portrait);
            }

            if (MainTabWindow_BaseAnimator.Develop)
            {
                // for debug
                Material centerMat = GraphicDatabase.Get <Graphic_Single>(
                    "Hands/Human_Hand_dev",
                    ShaderDatabase.CutoutSkin,
                    Vector2.one,
                    Color.white).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    handMeshLeft,
                    drawPos + shoulperPos.LeftJoint + new Vector3(0, -0.301f, 0),
                    bodyQuat * Quaternion.AngleAxis(-shoulderAngle[0], Vector3.up),
                    centerMat,
                    portrait);

                GenDraw.DrawMeshNowOrLater(
                    handMeshRight,
                    drawPos + shoulperPos.RightJoint + new Vector3(0, 0.301f, 0),
                    bodyQuat * Quaternion.AngleAxis(-shoulderAngle[1], Vector3.up),
                    centerMat,
                    portrait);
            }
        }
Пример #11
0
        public override void DrawFeet(Vector3 rootLoc, bool portrait)
        {
            if (portrait && !this.CompAnimator.AnimatorOpen)
            {
                return;
            }

            int   legsCount = 4;
            float legSpan   = 1f;


            Vector3 ground = rootLoc;

            ground.z += OffsetGround;

            Rot4 rot = this.BodyFacing;

            // Basic values
            BodyAnimDef body      = this.CompAnimator.BodyAnim;
            JointLister groundPos = this.GetJointPositions(
                body.hipOffsets[rot.AsInt],
                body.hipOffsets[Rot4.North.AsInt].x);

            WalkCycleDef cycle          = this.CompAnimator.WalkCycle;
            Vector3      rightFootAnim  = Vector3.zero;
            Vector3      leftFootAnim   = Vector3.zero;
            float        footAngleRight = 0;
            float        footAngleLeft  = 0;
            float        offsetJoint    = 0;

            if (cycle != null)
            {
                offsetJoint = cycle.HipOffsetHorizontalX.Evaluate(this.MovedPercent);

                this.DoWalkCycleOffsets(
                    ref rightFootAnim,
                    ref leftFootAnim,
                    ref footAngleRight,
                    ref footAngleLeft,
                    ref offsetJoint,
                    cycle.FootPositionX,
                    cycle.FootPositionZ,
                    cycle.FootAngle);
            }
            this.GetMeshesFoot(out Mesh footMeshRight, out Mesh footMeshLeft);

            float bodyAngle = 0f;

            Pawn pawn = this.Pawn;

            if (pawn.Downed || pawn.Dead)
            {
                bodyAngle = pawn.Drawer.renderer.wiggler.downedAngle;
            }

            Material matRight;

            Material matLeft;

            if (!MainTabWindow_Animator.Colored)
            {
                switch (rot.AsInt)
                {
                default:
                    matRight = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FootGraphicRight
                                                          ?.MatAt(rot));
                    matLeft = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FootGraphicLeft
                                                         ?.MatAt(rot));
                    break;

                case 1:
                    matRight = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FootGraphicRight
                                                          ?.MatAt(rot));
                    matLeft = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic
                                                         ?.FootGraphicLeftShadow
                                                         ?.MatAt(rot));
                    break;

                case 3:
                    matRight = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic
                                                          ?.FootGraphicRightShadow
                                                          ?.MatAt(rot));
                    matLeft = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FootGraphicLeft
                                                         ?.MatAt(rot));
                    break;
                }
            }
            else
            {
                matRight = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightCol?.MatAt(rot);
                matLeft  = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftCol?.MatAt(rot);
            }

            bool drawRight = matRight != null && this.CompAnimator.BodyStat.FootRight != PartStatus.Missing;

            bool drawLeft = matLeft != null && this.CompAnimator.BodyStat.FootLeft != PartStatus.Missing;

            if (drawLeft)
            {
                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    (ground + groundPos.LeftJoint + leftFootAnim)
                    .RotatedBy(bodyAngle),
                    Quaternion.AngleAxis(bodyAngle + footAngleLeft, Vector3.up),
                    matLeft,
                    portrait);
            }

            if (drawRight)
            {
                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    (ground + groundPos.RightJoint + rightFootAnim)
                    .RotatedBy(bodyAngle),
                    Quaternion.AngleAxis(bodyAngle + footAngleRight, Vector3.up),
                    matRight,
                    portrait);
            }

            if (MainTabWindow_Animator.Develop)
            {
                // for debug
                Material centerMat = GraphicDatabase
                                     .Get <Graphic_Single>("Hands/Ground", ShaderDatabase.Transparent, Vector2.one,
                                                           Color.red).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    ground.RotatedBy(bodyAngle) + groundPos.LeftJoint +
                    new Vector3(offsetJoint, -0.301f, 0),
                    Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    ground.RotatedBy(bodyAngle) + groundPos.RightJoint +
                    new Vector3(offsetJoint, 0.301f, 0),
                    Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z2),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
            }
        }
Пример #12
0
 public Defs(WalkCycleDef walkCycleDef)
 {
     this.WalkCycleDef = walkCycleDef;
 }
Пример #13
0
        protected virtual void DrawFrontPaws(Quaternion bodyQuat, Quaternion footQuat, Vector3 rootLoc, bool portrait)
        {
            if (!this.CompAnimator.Props.quadruped)
            {
                return;
            }


            // Basic values
            BodyAnimDef body = this.CompAnimator.BodyAnim;

            Rot4 rot = this.BodyFacing;

            if (body == null)
            {
                return;
            }

            JointLister jointPositions = this.GetJointPositions(JointType.Shoulder,
                                                                body.shoulderOffsets[rot.AsInt],
                                                                body.shoulderOffsets[Rot4.North.AsInt].x);

            Vector3 rightFootAnim  = Vector3.zero;
            Vector3 leftFootAnim   = Vector3.zero;
            float   footAngleRight = 0f;

            float footAngleLeft = 0f;
            float offsetJoint   = 0;

            WalkCycleDef cycle = this.CompAnimator.WalkCycle;

            if (cycle != null)
            {
                offsetJoint = cycle.ShoulderOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent);

                // Center = drawpos of carryThing
                this.DoWalkCycleOffsets(
                    ref rightFootAnim,
                    ref leftFootAnim,
                    ref footAngleRight,
                    ref footAngleLeft,
                    ref offsetJoint,
                    cycle.FrontPawPositionX,
                    cycle.FrontPawPositionZ,
                    cycle.FrontPawAngle);
            }

            this.GetBipedMesh(out Mesh footMeshRight, out Mesh footMeshLeft);

            Material matLeft;

            Material matRight;

            if (MainTabWindow_BaseAnimator.Colored)
            {
                matRight = this.CompAnimator.PawnBodyGraphic?.FrontPawGraphicRightCol?.MatAt(rot);
                matLeft  = this.CompAnimator.PawnBodyGraphic?.FrontPawGraphicLeftCol?.MatAt(rot);
            }
            else
            {
                switch (rot.AsInt)
                {
                default:
                    matRight = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FrontPawGraphicRight
                                                          ?.MatAt(rot));
                    matLeft = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FrontPawGraphicLeft
                                                         ?.MatAt(rot));
                    break;

                case 1:
                    matRight = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FrontPawGraphicRight
                                                          ?.MatAt(rot));
                    matLeft = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic
                                                         ?.FrontPawGraphicLeftShadow?.MatAt(rot));
                    break;

                case 3:
                    matRight = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic
                                                          ?.FrontPawGraphicRightShadow?.MatAt(rot));
                    matLeft = this.Flasher.GetDamagedMat(this.CompAnimator.PawnBodyGraphic?.FrontPawGraphicLeft
                                                         ?.MatAt(rot));
                    break;
                }
            }


            Quaternion drawQuat = this.CompAnimator.IsMoving ? footQuat : bodyQuat;
            Vector3    ground   = rootLoc + drawQuat * new Vector3(0, 0, OffsetGroundZ);

            if (matLeft != null)
            {
                if (this.CompAnimator.BodyStat.FootLeft != PartStatus.Missing)
                {
                    GenDraw.DrawMeshNowOrLater(
                        footMeshLeft,
                        ground + jointPositions.LeftJoint + leftFootAnim,
                        drawQuat * Quaternion.AngleAxis(footAngleLeft, Vector3.up),
                        matLeft,
                        portrait);
                }
            }

            if (matRight != null)
            {
                if (this.CompAnimator.BodyStat.FootRight != PartStatus.Missing)
                {
                    GenDraw.DrawMeshNowOrLater(
                        footMeshRight,
                        ground + jointPositions.RightJoint +
                        rightFootAnim,
                        drawQuat * Quaternion.AngleAxis(footAngleRight, Vector3.up),
                        matRight,
                        portrait);
                }
            }

            if (MainTabWindow_BaseAnimator.Develop)
            {
                // for debug
                Material centerMat = GraphicDatabase
                                     .Get <Graphic_Single>("Hands/Ground", ShaderDatabase.Transparent, Vector2.one,
                                                           Color.cyan).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    ground + jointPositions.LeftJoint +
                    new Vector3(offsetJoint, 0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    ground + jointPositions.RightJoint +
                    new Vector3(offsetJoint, 0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z2),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
            }
        }
Пример #14
0
        public static void BuildWalkCycles([CanBeNull] WalkCycleDef defToRebuild = null)
        {
            List <WalkCycleDef> cycles = new List <WalkCycleDef>();

            if (defToRebuild != null)
            {
                cycles.Add(defToRebuild);
            }
            else
            {
                cycles = DefDatabase <WalkCycleDef> .AllDefsListForReading;
            }

            if (cycles == null)
            {
                return;
            }

            for (int index = 0; index < cycles.Count; index++)
            {
                WalkCycleDef cycle = cycles[index];
                if (cycle != null)
                {
                    cycle.HeadAngleX  = new SimpleCurve();
                    cycle.HeadOffsetZ = new SimpleCurve();

                    cycle.BodyAngle         = new SimpleCurve();
                    cycle.BodyAngleVertical = new SimpleCurve();
                    cycle.BodyOffsetZ       = new SimpleCurve();

                    // cycle.BodyOffsetVerticalZ = new SimpleCurve();
                    cycle.FootAngle     = new SimpleCurve();
                    cycle.FootPositionX = new SimpleCurve();
                    cycle.FootPositionZ = new SimpleCurve();

                    // cycle.FootPositionVerticalZ = new SimpleCurve();
                    cycle.HandsSwingAngle           = new SimpleCurve();
                    cycle.HandsSwingPosVertical     = new SimpleCurve();
                    cycle.ShoulderOffsetHorizontalX = new SimpleCurve();
                    cycle.HipOffsetHorizontalX      = new SimpleCurve();

                    // Quadrupeds
                    cycle.FrontPawAngle     = new SimpleCurve();
                    cycle.FrontPawPositionX = new SimpleCurve();
                    cycle.FrontPawPositionZ = new SimpleCurve();

                    // cycle.FrontPawPositionVerticalZ = new SimpleCurve();
                    if (cycle.keyframes.NullOrEmpty())
                    {
                        cycle.keyframes = new List <PawnKeyframe>();
                        for (int i = 0; i < 9; i++)
                        {
                            cycle.keyframes.Add(new PawnKeyframe(i));
                        }
                    }

                    // Log.Message(cycle.defName + " has " + cycle.animation.Count);
                    foreach (PawnKeyframe key in cycle.keyframes)
                    {
                        BuildAnimationKeys(key, cycle);
                    }
                }
            }
        }
Пример #15
0
        private static void BuildAnimationKeys(PawnKeyframe key, WalkCycleDef cycle)
        {
            List <PawnKeyframe> keyframes = cycle.keyframes;

            List <PawnKeyframe> autoKeys = keyframes.Where(x => x.Status != KeyStatus.Manual).ToList();

            List <PawnKeyframe> manualKeys = keyframes.Where(x => x.Status == KeyStatus.Manual).ToList();

            float autoFrames = (float)key.KeyIndex / (autoKeys.Count - 1);

            float frameAt;

            // Distribute manual keys
            if (!manualKeys.NullOrEmpty())
            {
                frameAt = (float)key.KeyIndex / (autoKeys.Count - 1);
                float divider = (float)1 / (autoKeys.Count - 1);
                float?shift   = manualKeys.Find(x => x.KeyIndex == key.KeyIndex)?.Shift;
                if (shift.HasValue)
                {
                    frameAt += divider * shift.Value;
                }
            }
            else
            {
                frameAt = (float)key.KeyIndex / (keyframes.Count - 1);
            }

            Dictionary <SimpleCurve, float?> dict = new Dictionary <SimpleCurve, float?>
            {
                { cycle.HeadAngleX, key.HeadAngleX },
                { cycle.HeadOffsetZ, key.HeadOffsetZ },
                {
                    cycle.ShoulderOffsetHorizontalX,
                    key.ShoulderOffsetHorizontalX
                },
                {
                    cycle.HipOffsetHorizontalX,
                    key.HipOffsetHorizontalX
                },
                {
                    cycle.BodyAngleVertical,
                    key.BodyAngleVertical
                },
                {
                    cycle.BodyOffsetZ,
                    key.BodyOffsetZ
                },
                {
                    cycle.FootAngle,
                    key.FootAngle
                },
                {
                    cycle.FootPositionX,
                    key.FootPositionX
                },
                {
                    cycle.FootPositionZ,
                    key.FootPositionZ
                },
                {
                    cycle.HandsSwingAngle,
                    key.HandsSwingAngle
                },
                {
                    cycle.HandsSwingPosVertical,
                    key.HandsSwingAngle
                },
                {
                    cycle.FrontPawAngle,
                    key.FrontPawAngle
                },
                {
                    cycle.FrontPawPositionX,
                    key.FrontPawPositionX
                },
                {
                    cycle.FrontPawPositionZ,
                    key.FrontPawPositionZ
                }

                // { cycle.BodyOffsetVerticalZ, key.BodyOffsetVerticalZ },

                // { cycle.FootPositionVerticalZ, key.FootPositionVerticalZ },

                // { cycle.HandsSwingPosVertical, key.HandsSwingPosVertical },
                // {
                // cycle.FrontPawPositionVerticalZ,
                // key.FrontPawPositionVerticalZ
                // }
            };

            foreach (KeyValuePair <SimpleCurve, float?> pair in dict)
            {
                UpdateCurve(key, pair.Value, pair.Key, frameAt);
            }
        }
Пример #16
0
 public void SetWalkCycle(WalkCycleDef walkCycleDef)
 {
     this._walkCycle = walkCycleDef;
 }
Пример #17
0
        public override void DrawFeet(Quaternion bodyQuat, Quaternion footQuat, Vector3 rootLoc, bool portrait)
        {
            if (this.Pawn.Dead || this.Pawn.Downed)
            {
                return;
            }
            /// No feet while sitting at a table
            Job curJob = this.Pawn.CurJob;

            if (curJob != null)
            {
                if (curJob.def == JobDefOf.Ingest && !this.Pawn.Rotation.IsHorizontal)
                {
                    if (curJob.targetB.IsValid)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            Rot4    rotty  = new Rot4(i);
                            IntVec3 intVec = this.Pawn.Position + rotty.FacingCell;
                            if (intVec == curJob.targetB)
                            {
                                return;
                            }
                        }
                    }
                }
            }

            if (portrait && !HarmonyPatchesFS.AnimatorIsOpen())
            {
                return;
            }

            Quaternion drawQuat = this.CompAnimator.IsMoving ? footQuat : bodyQuat;

            Rot4 rot = this.BodyFacing;

            // Basic values
            BodyAnimDef body = this.CompAnimator.BodyAnim;

            if (body == null)
            {
                return;
            }

            JointLister groundPos = this.GetJointPositions(JointType.Hip,
                                                           body.hipOffsets[rot.AsInt],
                                                           body.hipOffsets[Rot4.North.AsInt].x);

            Vector3      rightFootCycle = Vector3.zero;
            Vector3      leftFootCycle  = Vector3.zero;
            float        footAngleRight = 0;
            float        footAngleLeft  = 0;
            float        offsetJoint    = 0;
            WalkCycleDef cycle          = this.CompAnimator.WalkCycle;

            if (cycle != null)
            {
                offsetJoint = cycle.HipOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent);

                this.DoWalkCycleOffsets(
                    ref rightFootCycle,
                    ref leftFootCycle,
                    ref footAngleRight,
                    ref footAngleLeft,
                    ref offsetJoint,
                    cycle.FootPositionX,
                    cycle.FootPositionZ,
                    cycle.FootAngle);
            }

            this.GetBipedMesh(out Mesh footMeshRight, out Mesh footMeshLeft);

            Material matRight;
            Material matLeft;

            if (MainTabWindow_BaseAnimator.Colored)
            {
                matRight = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightCol?.MatAt(rot);
                matLeft  = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftCol?.MatAt(rot);
            }
            else
            {
                Material rightFoot   = this.CompAnimator.PawnBodyGraphic?.FootGraphicRight?.MatAt(rot);
                Material leftFoot    = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeft?.MatAt(rot);
                Material leftShadow  = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftShadow?.MatAt(rot);
                Material rightShadow = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightShadow?.MatAt(rot);

                switch (rot.AsInt)
                {
                default:
                    matRight = this.Flasher.GetDamagedMat(rightFoot);
                    matLeft  = this.Flasher.GetDamagedMat(leftFoot);
                    break;

                case 1:
                    matRight = this.Flasher.GetDamagedMat(rightFoot);

                    matLeft = this.Flasher.GetDamagedMat(leftShadow);
                    break;

                case 3:

                    matRight = this.Flasher.GetDamagedMat(rightShadow);
                    matLeft  = this.Flasher.GetDamagedMat(leftFoot);
                    break;
                }
            }

            bool drawRight = matRight != null && this.CompAnimator.BodyStat.FootRight != PartStatus.Missing;

            bool drawLeft = matLeft != null && this.CompAnimator.BodyStat.FootLeft != PartStatus.Missing;

            groundPos.LeftJoint  = drawQuat * groundPos.LeftJoint;
            groundPos.RightJoint = drawQuat * groundPos.RightJoint;
            leftFootCycle        = drawQuat * leftFootCycle;
            rightFootCycle       = drawQuat * rightFootCycle;
            Vector3 ground = rootLoc + drawQuat * new Vector3(0, 0, OffsetGroundZ);

            if (drawLeft)
            {
                // TweenThing leftFoot = TweenThing.FootLeft;
                // PawnPartsTweener tweener = this.CompAnimator.PartTweener;
                // if (tweener != null)
                {
                    Vector3 position = ground + groundPos.LeftJoint + leftFootCycle;

                    // tweener.PartPositions[(int)leftFoot] = position;
                    // tweener.PreThingPosCalculation(leftFoot, spring: SpringTightness.Stff);

                    GenDraw.DrawMeshNowOrLater(
                        footMeshLeft,
                        position,                        // tweener.TweenedPartsPos[(int)leftFoot],
                        drawQuat * Quaternion.AngleAxis(footAngleLeft, Vector3.up),
                        matLeft,
                        portrait);
                }
            }

            if (drawRight)
            {
                // TweenThing rightFoot = TweenThing.FootRight;
                // PawnPartsTweener tweener = this.CompAnimator.PartTweener;
                // if (tweener != null)
                // {
                Vector3 position = ground + groundPos.RightJoint + rightFootCycle;

                // tweener.PartPositions[(int)rightFoot] = position;
                //     tweener.PreThingPosCalculation(rightFoot, spring: SpringTightness.Stff);
                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    position,                        // tweener.TweenedPartsPos[(int)rightFoot],
                    drawQuat * Quaternion.AngleAxis(footAngleRight, Vector3.up),
                    matRight,
                    portrait);

                // }
            }

            if (MainTabWindow_BaseAnimator.Develop)
            {
                // for debug
                Material centerMat = GraphicDatabase
                                     .Get <Graphic_Single>("Hands/Ground", ShaderDatabase.Transparent, Vector2.one,
                                                           Color.red).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    ground + groundPos.LeftJoint +
                    new Vector3(offsetJoint, -0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    ground + groundPos.RightJoint +
                    new Vector3(offsetJoint, 0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                Material hipMat = GraphicDatabase
                                  .Get <Graphic_Single>("Hands/Human_Hand_dev", ShaderDatabase.Transparent, Vector2.one,
                                                        Color.blue).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    groundPos.LeftJoint +
                    new Vector3(offsetJoint, -0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z2),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
            }
        }