Esempio n. 1
0
        public leftLegAnimation(bool ninverted)
        {
            inverted = ninverted;
            int invert = 1;

            if (inverted)
            {
                invert = -1;
            }
            currentTarget    = new MovementTarget(Quaternion.Identity, 1);
            rotation         = Quaternion.Identity;
            currentAnimation = AnimationType.none;



            walkArmSwingAmount = MathHelper.ToRadians(30);
            walkArmSwingSpeed  = .04f;
            swungForward       = Quaternion.CreateFromYawPitchRoll(0, walkArmSwingAmount, 0);
            swungBackward      = Quaternion.CreateFromYawPitchRoll(0, -walkArmSwingAmount, 0);
            if (inverted)
            {
                swungForward  = AnimationFunctions.mirror(swungForward);
                swungBackward = AnimationFunctions.mirror(swungBackward);
            }
        }
Esempio n. 2
0
        public override void handleOrder(List <AnimationType> type, AnimationSystem parent)
        {
            TorsoAnimation torso = parent as TorsoAnimation;

            if (torso != null)
            {
                swingTime = torso.swingTime;
            }



            if (type.Contains(AnimationType.running))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (swingTime), 0)
                                                   , .400000f);
            }
            else if (type.Contains(AnimationType.walking))
            {
                //rotation = Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (swingTime), 0);
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (swingTime), 0)
                                                   , .1200000f);
            }
            else if (type.Contains(AnimationType.standing))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0)
                                                   , .1200000f);
            }


            lerpRotation();
        }
        public override void handleOrder(List <AnimationType> type, AnimationSystem parent)
        {
            leftLegAnimation leftLeg = parent as leftLegAnimation;


            if (type.Contains(AnimationType.walking))
            {
                if (leftLeg != null)
                {
                    currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (inverted ? 1 : 1) *
                                                                                         (leftLeg.swingTime + (inverted ? -1 : 1) * 1), 0), .2f);
                }
            }
            else if (type.Contains(AnimationType.running))
            {
                if (leftLeg != null)
                {
                    currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (inverted ? 1 : 1) *
                                                                                         (leftLeg.swingTime + (inverted ? -1 : 1) * 2), 0), .2f);
                }
            }
            else if (type.Contains(AnimationType.standing))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .2f);
            }
            lerpRotation();
        }
Esempio n. 4
0
        public LowerLeftArmAnimation(bool ninverted)
        {
            inverted = ninverted;
            int invert = 1;

            if (inverted)
            {
                invert = -1;
            }
            currentTarget    = new MovementTarget(Quaternion.Identity, 1);
            rotation         = Quaternion.Identity;
            currentAnimation = AnimationType.none;



            walkArmSwingAmount = MathHelper.ToRadians(25);
            walkArmSwingSpeed  = .02f;
            swungForward       = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(-90), 0, MathHelper.ToRadians(10));
            rest = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(0), 0, MathHelper.ToRadians(10));

            extended = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(0), 0, .001f);
            folded   = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(-90), 0, .001f);

            if (inverted)
            {
                swungForward = AnimationFunctions.mirror(swungForward);
                rest         = AnimationFunctions.mirror(rest);
            }
        }
Esempio n. 5
0
        public override void handleOrder(List <AnimationType> type, AnimationSystem parent)
        {
            age++;
            //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age*5));



            if (type.Contains(AnimationType.torsoLeftShoulderForward))
            {
                //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age * 5));
                currentTarget = new MovementTarget(leftShoulderForward, .02f);


                //swingTimeInter.floatingCameraSpeed = .1f;
            }
            else if (type.Contains(AnimationType.walking))
            {
                //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age * 5));
                periodInter.idealValue    = 5;
                magInter.idealValue       = 1;
                swingTimeInter.idealValue = (float)Math.Sin(MathHelper.ToRadians((float)age * 7)) * 1;
                currentTarget             = new MovementTarget(Quaternion.CreateFromYawPitchRoll(getYaw(), 0, 0), 2f);


                //swingTimeInter.floatingCameraSpeed = .1f;
            }
            else if (type.Contains(AnimationType.running))
            {
                //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age * 12)) * 2;
                //periodInter.idealValue = 10;
                magInter.idealValue       = 3;
                swingTimeInter.idealValue = (float)Math.Sin(MathHelper.ToRadians((float)age * 10)) * 2;
                //rotation = Quaternion.CreateFromYawPitchRoll(getYaw(), 0, 0);
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(getYaw(), 0, 0), .2f);


                //swingTimeInter.floatingCameraSpeed = .5f;
            }
            else
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .2f);
            }
            swingTimeInter.update();
            periodInter.update();
            magInter.update();
            swingTime = swingTimeInter.value;
            lerpRotation();
            //currentAnimation = taskType;

            //rotation = Quaternion.Slerp(rotation, currentTarget.goal, currentTarget.floatingCameraSpeed / AnimationFunctions.angleBetweenQuaternions(rotation, currentTarget.goal));
        }
Esempio n. 6
0
        public override void handleOrder(List <AnimationType> type, AnimationSystem parent)
        {
            if (type.Contains(AnimationType.running) || type.Contains(AnimationType.walking))
            {
                turn    += 5;
                rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(-turn));
            }
            else if (type.Contains(AnimationType.standing))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll((0
                                                                                      ), 0, MathHelper.ToRadians(1)), .2f);
            }


            //lerpRotation();
        }
Esempio n. 7
0
        public override void handleOrder(List <AnimationType> type, AnimationSystem parent)
        {
            leftArmAnimation parentArm = parent as leftArmAnimation;


            if (type.Contains(AnimationType.armsOut))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .2f);
            }
            else if (type.Contains(AnimationType.stabLeftArm) && !inverted)
            {
                currentTarget = new MovementTarget(extended, .6f);
            }
            else if (type.Contains(AnimationType.stabRightArm) && inverted)
            {
                currentTarget = new MovementTarget(extended, .6f);
            }
            else if (type.Contains(AnimationType.hammerHitLoweredLeftArm) && !inverted)
            {
                currentTarget = new MovementTarget(folded, .2f);
            }
            else if (type.Contains(AnimationType.hammerHitRaisedLeftArm) && !inverted)
            {
                currentTarget = new MovementTarget(extended, .2f);
            }
            else if (type.Contains(AnimationType.running) || type.Contains(AnimationType.walking))
            {
                if (parentArm != null)
                {
                    currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll((-parentArm.parentSwingTime / 2 + (inverted ? 1 : -1) * (2 - MathHelper.ToRadians(90))), (inverted ? 1 : -1) * walkArmSwingAmount * (inverted ? 1 : 1) *
                                                                                         0, 0), .2f);
                }
            }
            else if (type.Contains(AnimationType.standing))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll((0
                                                                                      ), 0, MathHelper.ToRadians(1)), .2f);
            }


            lerpRotation();
        }
Esempio n. 8
0
        public override void handleOrder(List <AnimationType> type, AnimationSystem parent)
        {
            if (type.Contains(AnimationType.walking) || type.Contains(AnimationType.running))
            {
                //rotation = Quaternion.CreateFromYawPitchRoll(-((TorsoAnimation)parent).getYaw()/1f, 0, 0);
                TorsoAnimation torso = parent as TorsoAnimation;
                if (torso != null)
                {
                    currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(-(torso).getYaw() * 1f, 0, 0), .09f);
                }
            }
            else
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .09f);
            }

            //currentAnimation = taskType;

            //rotation = Quaternion.Slerp(rotation, currentTarget.goal, currentTarget.floatingCameraSpeed / AnimationFunctions.angleBetweenQuaternions(rotation, currentTarget.goal));
            lerpRotation();
        }
Esempio n. 9
0
        public leftArmAnimation(bool ninverted)
        {
            inverted = ninverted;
            int invert = 1;

            if (inverted)
            {
                invert = -1;
            }
            currentTarget = new MovementTarget(Quaternion.Identity, 1);
            rotation      = Quaternion.Identity;



            raised        = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(180), MathHelper.ToRadians(10), MathHelper.ToRadians(-110));
            lowered       = Quaternion.CreateFromYawPitchRoll(0, 0, MathHelper.ToRadians(80));
            loweredHammer = Quaternion.CreateFromYawPitchRoll(0, MathHelper.ToRadians(20), MathHelper.ToRadians(80));
            //forward = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(-90), 0, 0);
            //stabbedForward = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(45), MathHelper.ToRadians(90), MathHelper.ToRadians(90));
            stabbedForward  = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(0), MathHelper.ToRadians(90), MathHelper.ToRadians(90));
            stabbedForward *= Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(-45));



            walkArmSwingAmount = MathHelper.ToRadians(19);
            walkArmSwingSpeed  = .02f;
            swungForward       = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(0), walkArmSwingAmount, MathHelper.ToRadians(90));
            swungBackward      = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(0), -walkArmSwingAmount, MathHelper.ToRadians(90));
            if (inverted)
            {
                raised         = AnimationFunctions.mirror(raised);
                lowered        = AnimationFunctions.mirror(lowered);
                stabbedForward = AnimationFunctions.mirror(stabbedForward);
                swungForward   = AnimationFunctions.mirror(swungForward);
                swungBackward  = AnimationFunctions.mirror(swungBackward);
            }
        }
Esempio n. 10
0
        public override void handleOrder(List <AnimationType> types, AnimationSystem parent)
        {
            TorsoAnimation torso = parent as TorsoAnimation;

            if (torso != null)
            {
                parentSwingTime = torso.swingTime;
            }



            if (types.Contains(AnimationType.armsOut))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .200000f);
                Console.WriteLine("arms out");
            }
            else if (types.Contains(AnimationType.stabLeftArm) && !inverted)
            {
                currentTarget = new MovementTarget(stabbedForward, .6f);
            }
            else if (types.Contains(AnimationType.stabRightArm) && inverted)
            {
                currentTarget = new MovementTarget(stabbedForward, .6f);
            }

            else if (types.Contains(AnimationType.hammerHitLoweredLeftArm) && !inverted)
            {
                currentTarget = new MovementTarget(loweredHammer, .3f);
            }
            else if (types.Contains(AnimationType.hammerHitRaisedLeftArm) && !inverted)
            {
                currentTarget = new MovementTarget(raised, .3f);
            }

            else if (types.Contains(AnimationType.walking) || types.Contains(AnimationType.running))
            {
                float armSwingToUse = walkArmSwingAmount;
                if (inverted)
                {
                    if (types.Contains(AnimationType.toolInRightHand))
                    {
                        parentSwingTime /= 3f;
                    }
                }
                else
                {
                    if (types.Contains(AnimationType.toolInLeftHand))
                    {
                        parentSwingTime /= 3f;
                    }
                }


                //rotation = Quaternion.CreateFromYawPitchRoll(0, (inverted ? -1 : 1) * walkArmSwingAmount * parentSwingTime, (inverted ? -1 : 1) * MathHelper.ToRadians(90));
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? -1 : 1) * armSwingToUse * parentSwingTime,
                                                                                     (inverted ? -1 : 1) * MathHelper.ToRadians(90)), .2f);
            }
            else if (types.Contains(AnimationType.standing))
            {
                currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0,
                                                                                     (inverted ? -1 : 1) * MathHelper.ToRadians(85)), .2f);
            }



            lerpRotation();
        }
Esempio n. 11
0
 public WheelAnimation()
 {
     currentTarget    = new MovementTarget(Quaternion.Identity, 1);
     rotation         = Quaternion.Identity;
     currentAnimation = AnimationType.none;
 }